Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp91939iof; Sun, 5 Jun 2022 22:06:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfg4qkddHBg2zpnMlKJwPXntuzFa3WnAmK7S+X/nELAs22pBEVxQdpjTsq6XZaZ6+Q/XW2 X-Received: by 2002:a63:f911:0:b0:3fd:8dbc:8a23 with SMTP id h17-20020a63f911000000b003fd8dbc8a23mr6477677pgi.365.1654491991483; Sun, 05 Jun 2022 22:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654491991; cv=none; d=google.com; s=arc-20160816; b=jdrQxcpUdw/kEkpdSEwW8uvcLr57m07ygMfJ1Nr4biYjU5FnryXDfIndQMDTwPzQKR pAKysk5M7Ooelx9uLBNZ7s9vug06k1xWy7ENclKbPrm0xly4bSyXLTPtoGhQZHY2vORc uuQl+Q2BPAWPXnZjxWE/eI4FaGU1lINbx7lP4JDbIYs2nuim38n6pdfwzzmzIuZ6i0s1 Gl/kwjPwQvQIFlBplyrJ3PBtNNDKYtFw6eBAlC8kS1yZPlRtCPOP0fCBQ1zLTN5AZEkS c6DmyLBDHe+5f9T3BXvSq2RZ9OSP2Gzw02iTJuCz9N0qX/5nsFzmAbZwLn78tSUkeKiZ iR1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ixPNpJXNxCrkH6m95bjklRlhnWHapvw1lTyCnMl6Iq0=; b=T7C2SGD0LyY6Nd1AehLvt7a75PJ8G8YPUTmNSipU3+joqEfK7HHZLVJGCTKHQWPXr9 vmoI/5/5BvgeRtwJ3Knobpm1s15Z2upmkuP2n9n5udCuURV4mOTFaXeODETsgI5sjFxa Xrz7knBaMQcCGZ8MHXhRzoXMQQuA5C7FAzd+HPwdlIW67OREVfDPeJ7ebdUBk+M+5/s9 KVRoFm6lOev3UGWIv6c4CC1Z048fXi9mugV4MaLj556L/g8GElKHi8ZvBsol6gIA1oy4 iquAzmD+H5CSTLwdSegus6ceonAcLg2q3NDRCdqebVe8xY4RthBJ7UOSfJyZYuEvKNM3 LRYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YuECi+Ve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u7-20020a170902e5c700b00166449db813si16555306plf.464.2022.06.05.22.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YuECi+Ve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A307F135685; Sun, 5 Jun 2022 21:15:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351153AbiFEQIU (ORCPT + 99 others); Sun, 5 Jun 2022 12:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241758AbiFEQIS (ORCPT ); Sun, 5 Jun 2022 12:08:18 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E14D64FD; Sun, 5 Jun 2022 09:08:17 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id kq6so11702498ejb.11; Sun, 05 Jun 2022 09:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ixPNpJXNxCrkH6m95bjklRlhnWHapvw1lTyCnMl6Iq0=; b=YuECi+VeLtzEzHynphVhiRdt2h+Qv9lB4MNEgjeCnoWBmZKhoxaS+aj0WFoFqlTU2L mPGXhTFSARG9ocIKefhlHDIn+NAMjMQUzgkYYjwGepsirFG0b9BCaqiH4CwGFIQb95Q/ wiUbxAQj/8WFG+RAT4dN1lENTq11F2EAs0MNbgxJI4qu14Z4KenniYy9fQnq4YoYGArj U/xtUfAEBxZbwGoHbhxZgf0+IWsHPSrJVogzMGsxsNGDOliPeDKprDnuzBr7wi8C723k vRBo47cX+SRb4Lf1RurN2uXfdvT+xjoBhtRTOJa8snOu/yqk0Ho62bkT6m+5oLAn65t2 R40w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ixPNpJXNxCrkH6m95bjklRlhnWHapvw1lTyCnMl6Iq0=; b=zSAwQs0L+gdTH/8mCv6RpP/v8xl1/oo/Q8+M7Om/zk5hJjxX2AqGVZaJKHKby3o9n6 ZynTPfgtqvm6SPy9Cmc2bb9BVY4sf66s4USDO0V47yuJmKXWcbA64lNS6emJYW8d440o xft6YeTMfeRWu164aqcU7aAjjvv25gLFnpYOTjCfuDck1wdfg3zooF70VQ1UNa0tn11I TXodAPRGwkh8Ovid9S2pK2fEn7V7ZlMjHN8O5//1G674TxSs40qnmcWugc0+7DU+iH5X wg0YjPR73kL9bgLAhkZywRTVhC0DX8BoVaNUIU9+A7eHHDXZM3q3xycecOUYyO2ifogT cVSQ== X-Gm-Message-State: AOAM53095iw7uMZEmIwTjxBv+LbzIM8/0nkV0PP/TDpXaplWJgUqa6GW LvWrpDjjC0r22d4ohtnmsXU= X-Received: by 2002:a17:907:1c2a:b0:6ff:4275:1e54 with SMTP id nc42-20020a1709071c2a00b006ff42751e54mr18111035ejc.138.1654445295762; Sun, 05 Jun 2022 09:08:15 -0700 (PDT) Received: from localhost.localdomain (239.125-180-91.adsl-dyn.isp.belgacom.be. [91.180.125.239]) by smtp.gmail.com with ESMTPSA id j3-20020a170906050300b006fed99e1143sm5242240eja.61.2022.06.05.09.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 09:07:58 -0700 (PDT) From: Luc Van Oostenryck To: Arnd Bergmann Cc: Andrew Morton , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E. McKenney" , Luc Van Oostenryck , kernel test robot , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= Subject: [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg() Date: Sun, 5 Jun 2022 18:07:38 +0200 Message-Id: <20220605160738.79736-1-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <87h7547k8c.fsf@toke.dk> References: <87h7547k8c.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On IA64, new sparse's warnings where issued after fixing some __rcu annotations in kernel/bpf/. These new warnings are false positives and appear on IA64 because on this architecture, the macros for cmpxchg() and xchg() make casts that ignore sparse annotations. This patch contains the minimal patch to fix this issue: adding a missing cast and some missing '__force'. Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail Reported-by: kernel test robot Cc: Toke Høiland-Jørgensen Signed-off-by: Luc Van Oostenryck --- Note: This patch is only compile tested on defconfig. The corresponding binary is unchanged (except some .rodata with the kernel version) as it should be. arch/ia64/include/uapi/asm/cmpxchg.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h index 2c2f3cfeaa77..ca2e02685343 100644 --- a/arch/ia64/include/uapi/asm/cmpxchg.h +++ b/arch/ia64/include/uapi/asm/cmpxchg.h @@ -33,24 +33,24 @@ extern void ia64_xchg_called_with_bad_pointer(void); \ switch (size) { \ case 1: \ - __xchg_result = ia64_xchg1((__u8 *)ptr, x); \ + __xchg_result = ia64_xchg1((__u8 __force *)ptr, x); \ break; \ \ case 2: \ - __xchg_result = ia64_xchg2((__u16 *)ptr, x); \ + __xchg_result = ia64_xchg2((__u16 __force *)ptr, x); \ break; \ \ case 4: \ - __xchg_result = ia64_xchg4((__u32 *)ptr, x); \ + __xchg_result = ia64_xchg4((__u32 __force *)ptr, x); \ break; \ \ case 8: \ - __xchg_result = ia64_xchg8((__u64 *)ptr, x); \ + __xchg_result = ia64_xchg8((__u64 __force *)ptr, x); \ break; \ default: \ ia64_xchg_called_with_bad_pointer(); \ } \ - __xchg_result; \ + (__typeof__ (*(ptr)) __force) __xchg_result; \ }) #ifndef __KERNEL__ @@ -76,42 +76,42 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void); \ switch (size) { \ case 1: \ - _o_ = (__u8) (long) (old); \ + _o_ = (__u8) (long __force) (old); \ break; \ case 2: \ - _o_ = (__u16) (long) (old); \ + _o_ = (__u16) (long __force) (old); \ break; \ case 4: \ - _o_ = (__u32) (long) (old); \ + _o_ = (__u32) (long __force) (old); \ break; \ case 8: \ - _o_ = (__u64) (long) (old); \ + _o_ = (__u64) (long __force) (old); \ break; \ default: \ break; \ } \ switch (size) { \ case 1: \ - _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \ + _r_ = ia64_cmpxchg1_##sem((__u8 __force *) ptr, new, _o_); \ break; \ \ case 2: \ - _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \ + _r_ = ia64_cmpxchg2_##sem((__u16 __force *) ptr, new, _o_); \ break; \ \ case 4: \ - _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \ + _r_ = ia64_cmpxchg4_##sem((__u32 __force *) ptr, new, _o_); \ break; \ \ case 8: \ - _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \ + _r_ = ia64_cmpxchg8_##sem((__u64 __force *) ptr, new, _o_); \ break; \ \ default: \ _r_ = ia64_cmpxchg_called_with_bad_pointer(); \ break; \ } \ - (__typeof__(old)) _r_; \ + (__typeof__(old) __force) _r_; \ }) #define cmpxchg_acq(ptr, o, n) \ -- 2.36.1