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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E54DECD128A for ; Wed, 3 Apr 2024 22:21:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D9E26B0098; Wed, 3 Apr 2024 18:21:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 747006B009B; Wed, 3 Apr 2024 18:21:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60E976B009C; Wed, 3 Apr 2024 18:21:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3D8366B0098 for ; Wed, 3 Apr 2024 18:21:09 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C9F06A0E2B for ; Wed, 3 Apr 2024 22:21:08 +0000 (UTC) X-FDA: 81969642216.09.1593649 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf20.hostedemail.com (Postfix) with ESMTP id 80A611C0009 for ; Wed, 3 Apr 2024 22:21:06 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DcPak80Q; spf=pass (imf20.hostedemail.com: domain of "SRS0=NqB4=LI=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org" designates 145.40.73.55 as permitted sender) smtp.mailfrom="SRS0=NqB4=LI=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org"; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712182867; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=44tytAJWCXOzc7VTQ+F13jOwcWjkpnYcKFR/Hs5NO4w=; b=ykrtEpTBoRUYmFFc6fE6QBh4H519cAHSFF3fRO1AV10R9nNrRInt9i4fn18ZoQBnDr/UnZ e0DgKlb2Mx37R6+XGvloIucmZtqjySxtPAlIkfdH70YcTuXdN0Pn9QhmBfz5ysNAPameEc qE3PbkICHF5lgOYZwC05P0RmziY/g8M= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712182867; a=rsa-sha256; cv=none; b=bMOXQoaXcUzuQZoChBdnGyYNbDKnnlsrkXPLqNhqtCBiK2WmyN+47eaXxtSU+0nNIa+x5Y 8w+mAbMgrG1KXQMjFSTZBYyvgI2VphurQvBA/WEemVjVACc4Z8T6Wc49/JyakiCbbXsGHi euoTNzI15RgF/vInCTx+niWBQr873TQ= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DcPak80Q; spf=pass (imf20.hostedemail.com: domain of "SRS0=NqB4=LI=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org" designates 145.40.73.55 as permitted sender) smtp.mailfrom="SRS0=NqB4=LI=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org"; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 752B1CE1ADD; Wed, 3 Apr 2024 22:21:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4E85C433C7; Wed, 3 Apr 2024 22:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712182862; bh=X7pZJ+BPmVyNZv0MS4k9GJdhejgN9Ot2AEgbc9gfr5w=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=DcPak80Q3IRPu5RKHnkJGNB+hi/O2lH3GkvZPAJhXnEuaf2wadlMYVVLbNPcDSXVX JFE95UyOuRiHEuS5bW4LCBBwBbvdSUh1w5Fl8nhOGc4avFBOwEyriUxIr3dY0wh/p7 yV1qcwgJGWkmbMY7gJALr3/rzJAr2cHgJf/67YotSY12pyVdORGGaCdTV6EK3w9NyS iOrxnlayy/s8joHOoWDCwL7ltnaKu6zp8OvIonSn35cjzXISv0gw+93mwOTrHTnIsV L1CKsAcLtcsij10C+VhUJgDEmLBmmLBeC/tjjLQIXAIWFfb/4EReSODy+zHQtrB38U R9VFoGg2thUew== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 663E6CE109B; Wed, 3 Apr 2024 15:21:02 -0700 (PDT) Date: Wed, 3 Apr 2024 15:21:02 -0700 From: "Paul E. McKenney" To: Yujie Liu Cc: kernel test robot , oe-kbuild-all@lists.linux.dev, Linux Memory Management List Subject: Re: [linux-next:master 2559/3220] arch/riscv/include/asm/cmpxchg.h:329:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast Message-ID: Reply-To: paulmck@kernel.org References: <202404021504.YTP51bL3-lkp@intel.com> <55cfb596-8b21-4177-ab4c-0d531fb74c86@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 80A611C0009 X-Rspam-User: X-Stat-Signature: i787j1n9qihhubwucofqcb9ri6tbexwz X-Rspamd-Server: rspam03 X-HE-Tag: 1712182866-295758 X-HE-Meta: U2FsdGVkX19HITXRAuhT7sHr3j9l/ZwepxXeZisWYQqL9jsQ5c+4Z7h5Hx/uAvihxxTOCFyXKhtkRvVFbdLk3H0t2uSLL7WS6B9bVdYOl3PkBfy7YKncMsffA5olpQMvc3lIYBPCENufqtNwRWycuFFdeWlBqyn6egcMILD0zZHiUBVWW+NM0zZG11clpElnmurIRej/OBIXphPEglTaEpJvygQ3J8T0lyfUCc+/X0iHU7nrq2Yhh39hgNTFHLz3YIaHs1kSaKx6FoNQ425gSD/cag/zckBTTbhGjJrHsTGzTqgan7T7+46NDx2gkC75ukHSDU8cMn+X5gX/WUy4lQNaW/bK04hPbXbZJ4jCFjNLtv5YWaFXqtG415hpmTuCyMskBi2+ec1HSXLlndHlp8Z+QEVf7jnsUWI/yZRUMx+kWqI1zXPlitpJhXcHyPW3kSvMads54r0n7UIyvWspFhXnLsCqvExAAzqAFdDZHhwIB2LqF7eNdBoXO3tNYVSm8Y3xcxgIDP4qfPjrk/QlO8C43fvdezpZTvzIkQt670J4Eok0Iff8sGMc8pdKj/IwrGV9zdN2bDcLKTtg3L4jkWslMKnQdovI8qxGyeEmbD46TUvIcsTAvLOXHRB8W7Jy51Z6R8PfWc4tIghV1ep1Xj+95/3XQ69AyUsRLl1oO2VSfHFz/tJqWoHqOWp+EpkI5WPO8t6bnGqlYvbeJJ1ZMhqDnfT7R2Y4N1fAbOBPUHsE+V7RTp+lWSlCi2Qf5RcMJ+riEbWps5v6r0uBOOiW0Hptmvi1aIq3zhecZU3MdAKOICsZfF5ESOstAw3gQ0wQW5MXgIbblZhxW39TAsV106jWMz7++jhp6mGR02T5/43C/EK2AdSWci9uQd5QLVoHB24+8XXOUPymiAXPzl/XEmty+KWA1e0Z5SkwSh2ImvRbdMvw/R9nVWRVbsKdLP7AtmU5zVLCpIHp+1TJASd jR/u3/P7 E3eUgWvDHEDuktDMZWgErhRzIazozZpR1e7D54u1DiWv1kw9B3Hi5+uNN1M6UpDbJswhYRZNhb5NUtsAqwR+CRj/Q4SbjYjMu3I0tYsq2YFIFHcCpVA/8MKFcN1G5YkAQyvmrAmVL0xZG0p3rQP7fh1jRcd5YTTi2z0sWqzkfqHvoKjDWm6WktOt+5JFyXygrKfZdyLNIWD6IjKgLe/GIfKwElxw2UJ0jbOpSIUkjPJgnBH3a2dOGimD+eTAd3jC/uCAu0Pdk2UiwzaS076LlJSjQ1avQExnGFzIhbu5I5dgnghBKAmCOjxxyEg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Apr 03, 2024 at 02:57:54PM +0800, Yujie Liu wrote: > Hi Paul, > > On Tue, Apr 02, 2024 at 10:20:59AM -0700, Paul E. McKenney wrote: > > On Tue, Apr 02, 2024 at 03:08:07PM +0800, kernel test robot wrote: > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > > head: c0b832517f627ead3388c6f0c74e8ac10ad5774b > > > commit: df35ee400e06b23ecd44fdb66451a5343932f834 [2559/3220] riscv: Emulate one-byte and two-byte cmpxchg > > > config: riscv-randconfig-r061-20240402 (https://download.01.org/0day-ci/archive/20240402/202404021504.YTP51bL3-lkp@intel.com/config) > > > compiler: riscv64-linux-gcc (GCC) 13.2.0 > > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240402/202404021504.YTP51bL3-lkp@intel.com/reproduce) > > > > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > > > the same patch/commit), kindly add following tags > > > | Reported-by: kernel test robot > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202404021504.YTP51bL3-lkp@intel.com/ > > > > One fix leads to another. ;-) > > > > Does the patch at the end of this email clear things up? > > Please kindly see the inline comments. Good points, thank you, and alleged fix in progress. ;-) Thanx, Paul > > > All warnings (new ones prefixed by >>): > > > > > > In file included from arch/riscv/include/asm/atomic.h:19, > > > from include/linux/atomic.h:7, > > > from include/linux/cpumask.h:14, > > > from include/linux/smp.h:13, > > > from include/linux/lockdep.h:14, > > > from include/linux/spinlock.h:63, > > > from include/linux/mmzone.h:8, > > > from include/linux/gfp.h:7, > > > from include/linux/slab.h:16, > > > from drivers/accessibility/speakup/selection.c:2: > > > drivers/accessibility/speakup/selection.c: In function 'speakup_set_selection': > > > arch/riscv/include/asm/cmpxchg.h:329:62: warning: passing argument 2 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion] > > > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > > > | ^~~~~ > > > | | > > > | struct tty_struct * > > This warning is fixed after adding uintptr_t cast for __old and __new. > > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > > > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > In file included from arch/riscv/include/asm/cmpxchg.h:12: > > > include/linux/cmpxchg-emu.h:13:52: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > > > 13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new); > > > | ~~~~~~~~~~^~~ > > > arch/riscv/include/asm/cmpxchg.h:329:69: warning: passing argument 3 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion] > > > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > > > | ^~~~~ > > > | | > > > | struct tty_struct * > > So is this one. > > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > > > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > include/linux/cmpxchg-emu.h:13:67: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > > > 13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new); > > > | ~~~~~~~~~~^~~ > > > >> arch/riscv/include/asm/cmpxchg.h:329:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion] > > > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > > > | ^ > > This warning still exists. > > Seems it needs another cast like below to fix this warning: > > __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); > > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > > > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > arch/riscv/include/asm/cmpxchg.h:333:64: warning: passing argument 2 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion] > > > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > > | ^~~~~ > > > | | > > > | struct tty_struct * > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > > > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > include/linux/cmpxchg-emu.h:14:54: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > > > 14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new); > > > | ~~~~~~~~~~^~~ > > > arch/riscv/include/asm/cmpxchg.h:333:71: warning: passing argument 3 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion] > > > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > > | ^~~~~ > > > | | > > > | struct tty_struct * > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > > > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > include/linux/cmpxchg-emu.h:14:69: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > > > 14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new); > > > | ~~~~~~~~~~^~~ > > > arch/riscv/include/asm/cmpxchg.h:333:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion] > > > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > > | ^ > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > > > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > drivers/accessibility/speakup/selection.c: In function 'speakup_paste_selection': > > > arch/riscv/include/asm/cmpxchg.h:329:62: warning: passing argument 2 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion] > > > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > > > | ^~~~~ > > > | | > > > | struct tty_struct * > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > > > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > include/linux/cmpxchg-emu.h:13:52: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > > > 13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new); > > > | ~~~~~~~~~~^~~ > > > arch/riscv/include/asm/cmpxchg.h:329:69: warning: passing argument 3 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion] > > > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > > > | ^~~~~ > > > | | > > > | struct tty_struct * > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > > > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > include/linux/cmpxchg-emu.h:13:67: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > > > 13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new); > > > | ~~~~~~~~~~^~~ > > > >> arch/riscv/include/asm/cmpxchg.h:329:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion] > > > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > > > | ^ > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > > > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > arch/riscv/include/asm/cmpxchg.h:333:64: warning: passing argument 2 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion] > > > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > > | ^~~~~ > > > | | > > > | struct tty_struct * > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > > > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > include/linux/cmpxchg-emu.h:14:54: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > > > 14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new); > > > | ~~~~~~~~~~^~~ > > > arch/riscv/include/asm/cmpxchg.h:333:71: warning: passing argument 3 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion] > > > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > > | ^~~~~ > > > | | > > > | struct tty_struct * > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > > > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > include/linux/cmpxchg-emu.h:14:69: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > > > 14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new); > > > | ~~~~~~~~~~^~~ > > > arch/riscv/include/asm/cmpxchg.h:333:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion] > > > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > > | ^ > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > > > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > drivers/accessibility/speakup/selection.c: In function 'speakup_set_selection': > > > arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=] > > > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > > | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Here is a fallthrough warning. Looks like a copy-paste typo. The "break" > line and the "__ret = ..." line need to be swapped. > > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > > > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > arch/riscv/include/asm/cmpxchg.h:334:9: note: here > > > 334 | case 4: \ > > > | ^~~~ > > > arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg' > > > 368 | (__typeof__(*(ptr))) __cmpxchg((ptr), \ > > > | ^~~~~~~~~ > > > include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg' > > > 55 | #define raw_cmpxchg arch_cmpxchg > > > | ^~~~~~~~~~~~ > > > include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg' > > > 4788 | raw_cmpxchg(__ai_ptr, __VA_ARGS__); \ > > > | ^~~~~~~~~~~ > > > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > > > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > > > | ^~~~~~~ > > > > > > > > > vim +329 arch/riscv/include/asm/cmpxchg.h > > > > > > 319 > > > 320 #define __cmpxchg(ptr, old, new, size) \ > > > 321 ({ \ > > > 322 __typeof__(ptr) __ptr = (ptr); \ > > > 323 __typeof__(*(ptr)) __old = (old); \ > > > 324 __typeof__(*(ptr)) __new = (new); \ > > > 325 __typeof__(*(ptr)) __ret; \ > > > 326 register unsigned int __rc; \ > > > 327 switch (size) { \ > > > 328 case 1: \ > > > > 329 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > > > 330 break; \ > > > 331 case 2: \ > > > 332 break; \ > > > 333 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > Seems "break" is supposed to come after the assignment of __ret. > > > > 334 case 4: \ > > > 335 __asm__ __volatile__ ( \ > > > 336 "0: lr.w %0, %2\n" \ > > > 337 " bne %0, %z3, 1f\n" \ > > > 338 " sc.w.rl %1, %z4, %2\n" \ > > > 339 " bnez %1, 0b\n" \ > > > 340 RISCV_FULL_BARRIER \ > > > 341 "1:\n" \ > > > 342 : "=&r" (__ret), "=&r" (__rc), "+A" (*__ptr) \ > > > 343 : "rJ" ((long)__old), "rJ" (__new) \ > > > 344 : "memory"); \ > > > 345 break; \ > > > 346 case 8: \ > > > 347 __asm__ __volatile__ ( \ > > > 348 "0: lr.d %0, %2\n" \ > > > 349 " bne %0, %z3, 1f\n" \ > > > 350 " sc.d.rl %1, %z4, %2\n" \ > > > 351 " bnez %1, 0b\n" \ > > > 352 RISCV_FULL_BARRIER \ > > > 353 "1:\n" \ > > > 354 : "=&r" (__ret), "=&r" (__rc), "+A" (*__ptr) \ > > > 355 : "rJ" (__old), "rJ" (__new) \ > > > 356 : "memory"); \ > > > 357 break; \ > > > 358 default: \ > > > 359 BUILD_BUG(); \ > > > 360 } \ > > > 361 __ret; \ > > > 362 }) > > > 363 > > > > > > -- > > > 0-DAY CI Kernel Test Service > > > https://github.com/intel/lkp-tests/wiki > > > > ------------------------------------------------------------------------ > > > > diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h > > index a5b377481785c..fb1ac86ac2bf6 100644 > > --- a/arch/riscv/include/asm/cmpxchg.h > > +++ b/arch/riscv/include/asm/cmpxchg.h > > @@ -172,11 +172,11 @@ > > register unsigned int __rc; \ > > switch (size) { \ > > case 1: \ > > - __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > > + __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > > break; \ > > case 2: \ > > break; \ > > - __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > > + __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > > case 4: \ > > __asm__ __volatile__ ( \ > > "0: lr.w %0, %2\n" \ > > I drafted an extended fix patch as below. Could you help review? Not > sure if similar fixes should also be applied to the patches for other > architectures in the series? > > Thanks, > Yujie > > ------------------------------------------------------------------------- > > diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h > index a5b377481785c..4d5c281b1aced 100644 > --- a/arch/riscv/include/asm/cmpxchg.h > +++ b/arch/riscv/include/asm/cmpxchg.h > @@ -172,11 +172,11 @@ > register unsigned int __rc; \ > switch (size) { \ > case 1: \ > - __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > break; \ > case 2: \ > + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > break; \ > - __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > case 4: \ > __asm__ __volatile__ ( \ > "0: lr.w %0, %2\n" \ > @@ -222,11 +222,11 @@ > register unsigned int __rc; \ > switch (size) { \ > case 1: \ > - __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > break; \ > case 2: \ > + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > break; \ > - __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > case 4: \ > __asm__ __volatile__ ( \ > "0: lr.w %0, %2\n" \ > @@ -274,11 +274,11 @@ > register unsigned int __rc; \ > switch (size) { \ > case 1: \ > - __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > break; \ > case 2: \ > + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > break; \ > - __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > case 4: \ > __asm__ __volatile__ ( \ > RISCV_RELEASE_BARRIER \ > @@ -326,11 +326,11 @@ > register unsigned int __rc; \ > switch (size) { \ > case 1: \ > - __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > break; \ > case 2: \ > + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ > break; \ > - __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > case 4: \ > __asm__ __volatile__ ( \ > "0: lr.w %0, %2\n" \ >