* net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
@ 2024-10-08 21:32 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-10-08 21:32 UTC (permalink / raw)
To: Eric Dumazet
Cc: oe-kbuild-all, linux-kernel, Paolo Abeni, Guillaume Nault,
Kuniyuki Iwashima, Willem de Bruijn
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5b7c893ed5ed0fc1cbe28c0e3296a6fb45698486
commit: 223f55196bbdb182a9b8de6108a0834b5e5e832e inet_diag: allow concurrent operations
date: 9 months ago
config: hexagon-randconfig-r113-20241008 (https://download.01.org/0day-ci/archive/20241009/202410090504.9CJsN8Ma-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f)
reproduce: (https://download.01.org/0day-ci/archive/20241009/202410090504.9CJsN8Ma-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/202410090504.9CJsN8Ma-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
vim +1511 net/ipv4/inet_diag.c
1503
1504 int inet_diag_register(const struct inet_diag_handler *h)
1505 {
1506 const __u16 type = h->idiag_type;
1507
1508 if (type >= IPPROTO_MAX)
1509 return -EINVAL;
1510
> 1511 return !cmpxchg((const struct inet_diag_handler **)&inet_diag_table[type],
1512 NULL, h) ? 0 : -EEXIST;
1513 }
1514 EXPORT_SYMBOL_GPL(inet_diag_register);
1515
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
@ 2024-11-09 8:00 kernel test robot
2024-11-10 16:03 ` Willem de Bruijn
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2024-11-09 8:00 UTC (permalink / raw)
To: Eric Dumazet
Cc: oe-kbuild-all, linux-kernel, Paolo Abeni, Guillaume Nault,
Kuniyuki Iwashima, Willem de Bruijn
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: da4373fbcf006deda90e5e6a87c499e0ff747572
commit: 223f55196bbdb182a9b8de6108a0834b5e5e832e inet_diag: allow concurrent operations
date: 10 months ago
config: hexagon-randconfig-r112-20241109 (https://download.01.org/0day-ci/archive/20241109/202411091538.PGSTqUBi-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce: (https://download.01.org/0day-ci/archive/20241109/202411091538.PGSTqUBi-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/202411091538.PGSTqUBi-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
vim +1511 net/ipv4/inet_diag.c
1503
1504 int inet_diag_register(const struct inet_diag_handler *h)
1505 {
1506 const __u16 type = h->idiag_type;
1507
1508 if (type >= IPPROTO_MAX)
1509 return -EINVAL;
1510
> 1511 return !cmpxchg((const struct inet_diag_handler **)&inet_diag_table[type],
1512 NULL, h) ? 0 : -EEXIST;
1513 }
1514 EXPORT_SYMBOL_GPL(inet_diag_register);
1515
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
2024-11-09 8:00 kernel test robot
@ 2024-11-10 16:03 ` Willem de Bruijn
0 siblings, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2024-11-10 16:03 UTC (permalink / raw)
To: kernel test robot
Cc: Eric Dumazet, oe-kbuild-all, linux-kernel, Paolo Abeni,
Guillaume Nault, Kuniyuki Iwashima, David Howells, linux-hexagon,
bcain
On Sat, Nov 9, 2024 at 3:00 AM kernel test robot <lkp@intel.com> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: da4373fbcf006deda90e5e6a87c499e0ff747572
> commit: 223f55196bbdb182a9b8de6108a0834b5e5e832e inet_diag: allow concurrent operations
> date: 10 months ago
> config: hexagon-randconfig-r112-20241109 (https://download.01.org/0day-ci/archive/20241109/202411091538.PGSTqUBi-lkp@intel.com/config)
> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
> reproduce: (https://download.01.org/0day-ci/archive/20241109/202411091538.PGSTqUBi-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/202411091538.PGSTqUBi-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
> >> net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
>
> vim +1511 net/ipv4/inet_diag.c
>
> 1503
> 1504 int inet_diag_register(const struct inet_diag_handler *h)
> 1505 {
> 1506 const __u16 type = h->idiag_type;
> 1507
> 1508 if (type >= IPPROTO_MAX)
> 1509 return -EINVAL;
> 1510
> > 1511 return !cmpxchg((const struct inet_diag_handler **)&inet_diag_table[type],
> 1512 NULL, h) ? 0 : -EEXIST;
> 1513 }
> 1514 EXPORT_SYMBOL_GPL(inet_diag_register);
> 1515
The code is still present in latest net-next.
But this appears specific to the hexagon architecture. Specifically to
that initialization of __oldval to 0.
define arch_cmpxchg(ptr, old, new) \
({ \
__typeof__(ptr) __ptr = (ptr); \
__typeof__(*(ptr)) __old = (old); \
__typeof__(*(ptr)) __new = (new); \
__typeof__(*(ptr)) __oldval = 0; \
While here *ptr is of type const struct inet_diag_handler *.
Another typeof as cast seems to fix it:
+++ b/arch/hexagon/include/asm/cmpxchg.h
@@ -56,7 +56,7 @@ __arch_xchg(unsigned long x, volatile void *ptr, int size)
__typeof__(ptr) __ptr = (ptr); \
__typeof__(*(ptr)) __old = (old); \
__typeof__(*(ptr)) __new = (new); \
- __typeof__(*(ptr)) __oldval = 0; \
+ __typeof__(*(ptr)) __oldval = (__typeof__(*(ptr))) 0; \
Easily reproduced with
make LLVM=1 ARCH=hexagon defconfig
make C=1 LLVM=1 ARCH=hexagon net/ipv4/inet_diag.o
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-10 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 21:32 net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2024-11-09 8:00 kernel test robot
2024-11-10 16:03 ` Willem de Bruijn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox