From patchwork Mon Mar 22 16:02:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 406163 Delivered-To: patch@linaro.org Received: by 2002:a17:906:5290:0:0:0:0 with SMTP id c16csp1347955ejm; Mon, 22 Mar 2021 09:04:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPqur8egj9mxvwhpSrZnFj388jHW4lt+voPs0PeyYDAmgP7hJGJBD1BsEl29K8pML2pKwt X-Received: by 2002:a63:1e47:: with SMTP id p7mr267626pgm.133.1616429096377; Mon, 22 Mar 2021 09:04:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616429096; cv=none; d=google.com; s=arc-20160816; b=csfhtADiOfVXiWuCIQGzJE3l26qWCIMV7xnaezHrkMKHYuK/G5R25Ls6byldSL7PSB O9HgLFUMTRH+Z7i50S58Jtlr+t9G9JQYL2EBsQYVPci0RISvnzFUbQWwpRdEDwcfKDV/ J+vhsgLxa7PxABshNLRnNYUezzadZFuKxrNqXE3Fad9qX9v0ozqIvC5yeZze+bRiFYPI R1+0na3VQ7DCIkOfK/TcI7GMsBKO7DaYrSG3QAIRwfqtuOe/5fnI9BRuX7sf9f7ZXqZP o+0MEgP60ljVSsUH/taoe4jeTSZHw2X7i6Y92SbAsZzeNdb/pBjMlecseUn45W+0BDYd BYuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to; bh=p0P4w23YmEONacFIdJWllZwW/ihN4F5hrAl7MpkesMc=; b=ppGn7U0ZQo/J0h+yFCRM5ulmJeQJZFq1j3PM3UYc2WAoEmfEWJ4wKzac3apMSMIiv/ VQykaNKNGWuoHo/tfxcFVz4uhVTsljpi+Y7sWnGpMxkWXy6ECMsnAgyNXq78Co0GrhAf 3+VSN+9AdNOkxOQ6h47Hryc9mk1+eQZ4yvOW3xVJ6ENKPwBS5uq8G08JWs/3pFHBl/0h nr6d3GJ+N8Sr9T9GA3yhemHMEGXrwt2m5LT6BO8FnWO7Uh+DlhtXQymN1ynXCEYF8/K8 yP9H7FBZxDS9Z0ADLOMxl3G+k9oPKNyt0RpHLjvUNzERP/j/7CW2c/4/FiPMD9/gd+g2 r+Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b="qF3TQ/qA"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id z192si16245145pfc.213.2021.03.22.09.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 09:04:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b="qF3TQ/qA"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A0746E503; Mon, 22 Mar 2021 16:04:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3414B6E503; Mon, 22 Mar 2021 16:04:54 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id C1F12619AA; Mon, 22 Mar 2021 16:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616429094; bh=xAtyylaIqASvvaS85ZKuu0hXHauLkQxCojv0RLX/Mb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qF3TQ/qAB99dHQJQ17LkEWSGHzxXaa6ah0V394Zl3kvv8RzfyZLGR5LrTvWyC7H1A Y/FGboTYdhxs+1JdIoA84vXMKDdcAhTrEkBBb0UQUQKweCwvIzhlEQaLj3V5+EtINN TkIcf5XVjUiGPrExh51GxNaO8HstdwbBZt6yPypCRTLZ7dgkDLCsQKmQNcTUMokkXV S8QQatAQDJMuuHsGK0sG76w09rCi8u76J/NCDygW1XdPiFPESnsqpJ4LRffqASyFiK CjWew/HiP9HZ5pWACV/kafDp0YkSlO5krvl5NtQtLs6m/hkRHKNSKqc2U8LuhcidQu 4FzJ0OAQMgZGg== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Martin Sebor Subject: [PATCH 07/11] ARM: sharpsl_param: work around -Wstringop-overread warning Date: Mon, 22 Mar 2021 17:02:45 +0100 Message-Id: <20210322160253.4032422-8-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210322160253.4032422-1-arnd@kernel.org> References: <20210322160253.4032422-1-arnd@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Russell King , linux-scsi@vger.kernel.org, x86@kernel.org, James Smart , tboot-devel@lists.sourceforge.net, Kalle Valo , ath11k@lists.infradead.org, Serge Hallyn , Arnd Bergmann , "James E.J. Bottomley" , Ning Sun , Anders Larsen , cgroups@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-security-module@vger.kernel.org, Tejun Heo , Simon Kelley , intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann gcc warns that accessing a pointer based on a numeric constant may be an offset into a NULL pointer, and would therefore has zero accessible bytes: arch/arm/common/sharpsl_param.c: In function ‘sharpsl_save_param’: arch/arm/common/sharpsl_param.c:43:9: error: ‘memcpy’ reading 64 bytes from a region of size 0 [-Werror=stringop-overread] 43 | memcpy(&sharpsl_param, param_start(PARAM_BASE), sizeof(struct sharpsl_param_info)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In this particular case, the warning is bogus since this is the actual pointer, not an offset on a NULL pointer. Add a local variable to shut up the warning and hope it doesn't come back. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 Signed-off-by: Arnd Bergmann --- arch/arm/common/sharpsl_param.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c index efeb5724d9e9..6237ede2f0c7 100644 --- a/arch/arm/common/sharpsl_param.c +++ b/arch/arm/common/sharpsl_param.c @@ -40,7 +40,9 @@ EXPORT_SYMBOL(sharpsl_param); void sharpsl_save_param(void) { - memcpy(&sharpsl_param, param_start(PARAM_BASE), sizeof(struct sharpsl_param_info)); + struct sharpsl_param_info *params = param_start(PARAM_BASE); + + memcpy(&sharpsl_param, params, sizeof(*params)); if (sharpsl_param.comadj_keyword != COMADJ_MAGIC) sharpsl_param.comadj=-1;