All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vineet Gupta <vgupta@kernel.org>
To: kernel test robot <lkp@intel.com>, Bradley Morgan <brads@mainlining.org>
Cc: oe-kbuild-all@lists.linux.dev,
	linux-snps-arc@lists.infradead.org,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: [paulmckrcu:cmpxchg2.2026.09.22a 25/28] arch/arc/include/asm/cmpxchg.h:46:58: error: pointer type mismatch in conditional expression
Date: Thu, 24 Sep 2026 13:52:55 -0700	[thread overview]
Message-ID: <3cbe5de8-d04b-4afe-b19f-ad755d4ea320@kernel.org> (raw)
In-Reply-To: <202609241517.SSV1Goz3-lkp@intel.com>

On 9/24/26 00:51, kernel test robot wrote:
> tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
> head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
> commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
> config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20260924/202609241517.SSV1Goz3-lkp@intel.com/config)
> compiler: arc-linux-gcc (GCC) 16.1.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260924/202609241517.SSV1Goz3-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 <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202609241517.SSV1Goz3-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
>     In file included from arch/arc/include/asm/atomic.h:13,
>                      from include/linux/atomic.h:7,
>                      from include/asm-generic/bitops/lock.h:5,
>                      from arch/arc/include/asm/bitops.h:190,
>                      from include/linux/bitops.h:67,
>                      from include/linux/log2.h:12,
>                      from include/asm-generic/div64.h:55,
>                      from ./arch/arc/include/generated/asm/div64.h:1,
>                      from include/linux/math.h:6,
>                      from include/linux/math64.h:6,
>                      from include/linux/time.h:6,
>                      from include/linux/stat.h:19,
>                      from include/linux/fs_dirent.h:5,
>                      from include/linux/fs/super_types.h:5,
>                      from include/linux/fs/super.h:5,
>                      from include/linux/fs.h:5,
>                      from include/linux/fscrypt.h:16,
>                      from fs/crypto/fscrypt_private.h:15,
>                      from fs/crypto/hooks.c:10:
>     fs/crypto/hooks.c: In function 'fscrypt_get_symlink':
>>> arch/arc/include/asm/cmpxchg.h:46:58: error: pointer type mismatch in conditional expression [-Wincompatible-pointer-types]
>        46 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \

Issue is in  fs/crypto/hooks.c doing cmpxchg_release(&inode->i_link, 
NULL, pstr.name)
where i_link is char * and pstr.name is unsigned char *),

The problem is when pointer types are incompatible and that's exactly 
the W toggle above.

So Bradley's patch needs this fixup

diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
index 4596edfefa95..9053098bb152 100644
--- a/arch/arc/include/asm/cmpxchg.h
+++ b/arch/arc/include/asm/cmpxchg.h
@@ -42,8 +42,10 @@
  #define arch_cmpxchg_relaxed(ptr, old, new)     \
  ({    \
         __typeof__(ptr) _p_ = (ptr);     \
-       unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));       
       \
-       unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));       
       \
+       __typeof__(*(ptr)) _o_ = (old);    \
+       __typeof__(*(ptr)) _n_ = (new);    \
+       unsigned long _old_ = (unsigned long)_o_;            \
+       unsigned long _new_ = (unsigned long)_n_;            \

P.S: For arch changes shouldn't the submitter be required to at least 
test the building, specially when this involves the macro maze. Its 
really easy with crosstool hosting all the cross-compilers [1] - just 
download and untar.

[1] 
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/16.2.0/

Thx,
-Vineet

>           |                                                          ^
>     include/linux/atomic.h:68:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
>        68 |         op##_relaxed(args);                                             \
>           |         ^~
>     include/linux/atomic/atomic-arch-fallback.h:80:9: note: in expansion of macro '__atomic_op_release'
>        80 |         __atomic_op_release(arch_cmpxchg, __VA_ARGS__)
>           |         ^~~~~~~~~~~~~~~~~~~
>     include/linux/atomic/atomic-instrumented.h:4803:9: note: in expansion of macro 'raw_cmpxchg_release'
>      4803 |         raw_cmpxchg_release(__ai_ptr, __VA_ARGS__); \
>           |         ^~~~~~~~~~~~~~~~~~~
>     fs/crypto/hooks.c:420:13: note: in expansion of macro 'cmpxchg_release'
>       420 |             cmpxchg_release(&inode->i_link, NULL, pstr.name) != NULL)
>           |             ^~~~~~~~~~~~~~~
>     arch/arc/include/asm/cmpxchg.h:46:51: note: first expression has type 'char *'
>        46 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
>           |                                                   ^~~~~~
>     include/linux/atomic.h:68:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
>        68 |         op##_relaxed(args);                                             \
>           |         ^~
>     include/linux/atomic/atomic-arch-fallback.h:80:9: note: in expansion of macro '__atomic_op_release'
>        80 |         __atomic_op_release(arch_cmpxchg, __VA_ARGS__)
>           |         ^~~~~~~~~~~~~~~~~~~
>     include/linux/atomic/atomic-instrumented.h:4803:9: note: in expansion of macro 'raw_cmpxchg_release'
>      4803 |         raw_cmpxchg_release(__ai_ptr, __VA_ARGS__); \
>           |         ^~~~~~~~~~~~~~~~~~~
>     fs/crypto/hooks.c:420:13: note: in expansion of macro 'cmpxchg_release'
>       420 |             cmpxchg_release(&inode->i_link, NULL, pstr.name) != NULL)
>           |             ^~~~~~~~~~~~~~~
>     arch/arc/include/asm/cmpxchg.h:46:60: note: second expression has type 'unsigned char *'
>        46 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
>           |                                                            ^~~~~
>     include/linux/atomic.h:68:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
>        68 |         op##_relaxed(args);                                             \
>           |         ^~
>     include/linux/atomic/atomic-arch-fallback.h:80:9: note: in expansion of macro '__atomic_op_release'
>        80 |         __atomic_op_release(arch_cmpxchg, __VA_ARGS__)
>           |         ^~~~~~~~~~~~~~~~~~~
>     include/linux/atomic/atomic-instrumented.h:4803:9: note: in expansion of macro 'raw_cmpxchg_release'
>      4803 |         raw_cmpxchg_release(__ai_ptr, __VA_ARGS__); \
>           |         ^~~~~~~~~~~~~~~~~~~
>     fs/crypto/hooks.c:420:13: note: in expansion of macro 'cmpxchg_release'
>       420 |             cmpxchg_release(&inode->i_link, NULL, pstr.name) != NULL)
>           |             ^~~~~~~~~~~~~~~
>
>
> vim +46 arch/arc/include/asm/cmpxchg.h
>
>      41	
>      42	#define arch_cmpxchg_relaxed(ptr, old, new)				\
>      43	({									\
>      44		__typeof__(ptr) _p_ = (ptr);					\
>      45		unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));		\
>    > 46		unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));		\
>      47		__typeof__(*(ptr)) _prev_;					\
>      48										\
>      49		switch (sizeof(*(_p_))) {						\
>      50		case 1:								\
>      51			_prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, _old_, _new_);	\
>      52			break;							\
>      53		case 2:								\
>      54			_prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *__force)_p_, _old_, _new_);	\
>      55			break;							\
>      56		case 4:								\
>      57			_prev_ = (__typeof__(*(ptr)))__cmpxchg(_p_, _old_, _new_);			\
>      58			break;							\
>      59		default:							\
>      60			BUILD_BUG();						\
>      61		}								\
>      62		_prev_;								\
>      63	})
>      64	
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
> _______________________________________________
> linux-snps-arc mailing list
> linux-snps-arc@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-snps-arc


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

WARNING: multiple messages have this Message-ID (diff)
From: Vineet Gupta <vgupta@kernel.org>
To: kernel test robot <lkp@intel.com>, Bradley Morgan <brads@mainlining.org>
Cc: oe-kbuild-all@lists.linux.dev,
	linux-snps-arc@lists.infradead.org,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: [paulmckrcu:cmpxchg2.2026.09.22a 25/28] arch/arc/include/asm/cmpxchg.h:46:58: error: pointer type mismatch in conditional expression
Date: Thu, 24 Sep 2026 13:52:55 -0700	[thread overview]
Message-ID: <3cbe5de8-d04b-4afe-b19f-ad755d4ea320@kernel.org> (raw)
In-Reply-To: <202609241517.SSV1Goz3-lkp@intel.com>

On 9/24/26 00:51, kernel test robot wrote:
> tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
> head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
> commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
> config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20260924/202609241517.SSV1Goz3-lkp@intel.com/config)
> compiler: arc-linux-gcc (GCC) 16.1.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260924/202609241517.SSV1Goz3-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 <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202609241517.SSV1Goz3-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
>     In file included from arch/arc/include/asm/atomic.h:13,
>                      from include/linux/atomic.h:7,
>                      from include/asm-generic/bitops/lock.h:5,
>                      from arch/arc/include/asm/bitops.h:190,
>                      from include/linux/bitops.h:67,
>                      from include/linux/log2.h:12,
>                      from include/asm-generic/div64.h:55,
>                      from ./arch/arc/include/generated/asm/div64.h:1,
>                      from include/linux/math.h:6,
>                      from include/linux/math64.h:6,
>                      from include/linux/time.h:6,
>                      from include/linux/stat.h:19,
>                      from include/linux/fs_dirent.h:5,
>                      from include/linux/fs/super_types.h:5,
>                      from include/linux/fs/super.h:5,
>                      from include/linux/fs.h:5,
>                      from include/linux/fscrypt.h:16,
>                      from fs/crypto/fscrypt_private.h:15,
>                      from fs/crypto/hooks.c:10:
>     fs/crypto/hooks.c: In function 'fscrypt_get_symlink':
>>> arch/arc/include/asm/cmpxchg.h:46:58: error: pointer type mismatch in conditional expression [-Wincompatible-pointer-types]
>        46 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \

Issue is in  fs/crypto/hooks.c doing cmpxchg_release(&inode->i_link, 
NULL, pstr.name)
where i_link is char * and pstr.name is unsigned char *),

The problem is when pointer types are incompatible and that's exactly 
the W toggle above.

So Bradley's patch needs this fixup

diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
index 4596edfefa95..9053098bb152 100644
--- a/arch/arc/include/asm/cmpxchg.h
+++ b/arch/arc/include/asm/cmpxchg.h
@@ -42,8 +42,10 @@
  #define arch_cmpxchg_relaxed(ptr, old, new)     \
  ({    \
         __typeof__(ptr) _p_ = (ptr);     \
-       unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));       
       \
-       unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));       
       \
+       __typeof__(*(ptr)) _o_ = (old);    \
+       __typeof__(*(ptr)) _n_ = (new);    \
+       unsigned long _old_ = (unsigned long)_o_;            \
+       unsigned long _new_ = (unsigned long)_n_;            \

P.S: For arch changes shouldn't the submitter be required to at least 
test the building, specially when this involves the macro maze. Its 
really easy with crosstool hosting all the cross-compilers [1] - just 
download and untar.

[1] 
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/16.2.0/

Thx,
-Vineet

>           |                                                          ^
>     include/linux/atomic.h:68:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
>        68 |         op##_relaxed(args);                                             \
>           |         ^~
>     include/linux/atomic/atomic-arch-fallback.h:80:9: note: in expansion of macro '__atomic_op_release'
>        80 |         __atomic_op_release(arch_cmpxchg, __VA_ARGS__)
>           |         ^~~~~~~~~~~~~~~~~~~
>     include/linux/atomic/atomic-instrumented.h:4803:9: note: in expansion of macro 'raw_cmpxchg_release'
>      4803 |         raw_cmpxchg_release(__ai_ptr, __VA_ARGS__); \
>           |         ^~~~~~~~~~~~~~~~~~~
>     fs/crypto/hooks.c:420:13: note: in expansion of macro 'cmpxchg_release'
>       420 |             cmpxchg_release(&inode->i_link, NULL, pstr.name) != NULL)
>           |             ^~~~~~~~~~~~~~~
>     arch/arc/include/asm/cmpxchg.h:46:51: note: first expression has type 'char *'
>        46 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
>           |                                                   ^~~~~~
>     include/linux/atomic.h:68:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
>        68 |         op##_relaxed(args);                                             \
>           |         ^~
>     include/linux/atomic/atomic-arch-fallback.h:80:9: note: in expansion of macro '__atomic_op_release'
>        80 |         __atomic_op_release(arch_cmpxchg, __VA_ARGS__)
>           |         ^~~~~~~~~~~~~~~~~~~
>     include/linux/atomic/atomic-instrumented.h:4803:9: note: in expansion of macro 'raw_cmpxchg_release'
>      4803 |         raw_cmpxchg_release(__ai_ptr, __VA_ARGS__); \
>           |         ^~~~~~~~~~~~~~~~~~~
>     fs/crypto/hooks.c:420:13: note: in expansion of macro 'cmpxchg_release'
>       420 |             cmpxchg_release(&inode->i_link, NULL, pstr.name) != NULL)
>           |             ^~~~~~~~~~~~~~~
>     arch/arc/include/asm/cmpxchg.h:46:60: note: second expression has type 'unsigned char *'
>        46 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
>           |                                                            ^~~~~
>     include/linux/atomic.h:68:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
>        68 |         op##_relaxed(args);                                             \
>           |         ^~
>     include/linux/atomic/atomic-arch-fallback.h:80:9: note: in expansion of macro '__atomic_op_release'
>        80 |         __atomic_op_release(arch_cmpxchg, __VA_ARGS__)
>           |         ^~~~~~~~~~~~~~~~~~~
>     include/linux/atomic/atomic-instrumented.h:4803:9: note: in expansion of macro 'raw_cmpxchg_release'
>      4803 |         raw_cmpxchg_release(__ai_ptr, __VA_ARGS__); \
>           |         ^~~~~~~~~~~~~~~~~~~
>     fs/crypto/hooks.c:420:13: note: in expansion of macro 'cmpxchg_release'
>       420 |             cmpxchg_release(&inode->i_link, NULL, pstr.name) != NULL)
>           |             ^~~~~~~~~~~~~~~
>
>
> vim +46 arch/arc/include/asm/cmpxchg.h
>
>      41	
>      42	#define arch_cmpxchg_relaxed(ptr, old, new)				\
>      43	({									\
>      44		__typeof__(ptr) _p_ = (ptr);					\
>      45		unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));		\
>    > 46		unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));		\
>      47		__typeof__(*(ptr)) _prev_;					\
>      48										\
>      49		switch (sizeof(*(_p_))) {						\
>      50		case 1:								\
>      51			_prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, _old_, _new_);	\
>      52			break;							\
>      53		case 2:								\
>      54			_prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *__force)_p_, _old_, _new_);	\
>      55			break;							\
>      56		case 4:								\
>      57			_prev_ = (__typeof__(*(ptr)))__cmpxchg(_p_, _old_, _new_);			\
>      58			break;							\
>      59		default:							\
>      60			BUILD_BUG();						\
>      61		}								\
>      62		_prev_;								\
>      63	})
>      64	
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
> _______________________________________________
> linux-snps-arc mailing list
> linux-snps-arc@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-snps-arc


  reply	other threads:[~2026-09-24 20:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24  7:51 [paulmckrcu:cmpxchg2.2026.09.22a 25/28] arch/arc/include/asm/cmpxchg.h:46:58: error: pointer type mismatch in conditional expression kernel test robot
2026-09-24  7:51 ` kernel test robot
2026-09-24 20:52 ` Vineet Gupta [this message]
2026-09-24 20:52   ` Vineet Gupta
2026-09-24 20:58   ` Bradley Morgan
2026-09-24 20:58     ` Bradley Morgan
2026-09-24 21:27     ` Vineet Gupta
2026-09-24 21:27       ` Vineet Gupta
2026-09-29 20:47       ` Paul E. McKenney
2026-09-29 20:47         ` Paul E. McKenney
2026-09-29 22:10         ` Vineet Gupta
2026-09-29 22:10           ` Vineet Gupta
2026-09-30  6:39           ` Bradley Morgan
2026-09-30  6:39             ` Bradley Morgan
2026-09-30 17:57             ` Paul E. McKenney
2026-09-30 17:57               ` Paul E. McKenney
2026-09-30 17:55           ` Paul E. McKenney
2026-09-30 17:55             ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3cbe5de8-d04b-4afe-b19f-ad755d4ea320@kernel.org \
    --to=vgupta@kernel.org \
    --cc=brads@mainlining.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=paulmck@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.