From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00CCEC433EF for ; Thu, 23 Sep 2021 03:43:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBEFE60FE8 for ; Thu, 23 Sep 2021 03:43:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239486AbhIWDpF (ORCPT ); Wed, 22 Sep 2021 23:45:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:41226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239543AbhIWDnA (ORCPT ); Wed, 22 Sep 2021 23:43:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 283BA6124A; Thu, 23 Sep 2021 03:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632368434; bh=EOjRsXndgEJCGgH/hf63qiusVL92jYSBOV2Enjo0w8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DVkwkW6k8cwdu5u4ZqMOyWtSR7rD9mMgFumVYPIxllT5RuMHdyIkT+om7+wSTY5eu nMpOvyns2RTzb4UkdYmDkai14qRCVGX+azjU9Xg6+TZkY4K+iKTEhaAgasXHoDhzhE o3MAXbumwMz3s/rQ2DK4AuR+LNX7FX5Md5Dh6iIdowMOXu1/WYMmTPXVOCz7G4QEOc Dhd0Gqg+y9qcXdo9LsoWhgorHzD0kCELZWs6KC22pQjy67gpMcA3v/zIbSyo4r8cFU 1NxjCrxqiI0/2O5rEwDgi0Rif29DKPk7t0Zqyp/SgGkEIY4TadWDkzW289BQN1vCLz C4xbk9+ZFo+Aw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Guenter Roeck , Linus Torvalds , Geert Uytterhoeven , Sasha Levin , luc.vanoostenryck@gmail.com, linux-sparse@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 03/11] compiler.h: Introduce absolute_pointer macro Date: Wed, 22 Sep 2021 23:40:19 -0400 Message-Id: <20210923034028.1421876-3-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210923034028.1421876-1-sashal@kernel.org> References: <20210923034028.1421876-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org From: Guenter Roeck [ Upstream commit f6b5f1a56987de837f8e25cd560847106b8632a8 ] absolute_pointer() disassociates a pointer from its originating symbol type and context. Use it to prevent compiler warnings/errors such as drivers/net/ethernet/i825xx/82596.c: In function 'i82596_probe': arch/m68k/include/asm/string.h:72:25: error: '__builtin_memcpy' reading 6 bytes from a region of size 0 [-Werror=stringop-overread] Such warnings may be reported by gcc 11.x for string and memory operations on fixed addresses. Suggested-by: Linus Torvalds Signed-off-by: Guenter Roeck Reviewed-by: Geert Uytterhoeven Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- include/linux/compiler.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 824b1b97f989..10937279b152 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -233,6 +233,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); (typeof(ptr)) (__ptr + (off)); }) #endif +#define absolute_pointer(val) RELOC_HIDE((void *)(val), 0) + #ifndef OPTIMIZER_HIDE_VAR #define OPTIMIZER_HIDE_VAR(var) barrier() #endif -- 2.30.2