Patch "hexagon: fix using plain integer as NULL pointer warning in cmpxchg" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    hexagon: fix using plain integer as NULL pointer warning in cmpxchg

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hexagon-fix-using-plain-integer-as-null-pointer-warn.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ede5637b23fc6c34139f81e293b7eee58259c36f
Author: Willem de Bruijn <willemb@xxxxxxxxxx>
Date:   Tue Dec 3 17:17:34 2024 -0500

    hexagon: fix using plain integer as NULL pointer warning in cmpxchg
    
    [ Upstream commit 8a20030038742b9915c6d811a4e6c14b126cafb4 ]
    
    Sparse reports
    
        net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
    
    Due to this code calling cmpxchg on a non-integer type
    struct inet_diag_handler *
    
        return !cmpxchg((const struct inet_diag_handler**)&inet_diag_table[type],
                        NULL, h) ? 0 : -EEXIST;
    
    While hexagon's cmpxchg assigns an integer value to a variable of this
    type.
    
        __typeof__(*(ptr)) __oldval = 0;
    
    Update this assignment to cast 0 to the correct type.
    
    The original issue is easily reproduced at head with the below block,
    and is absent after this change.
    
        make LLVM=1 ARCH=hexagon defconfig
        make C=1 LLVM=1 ARCH=hexagon net/ipv4/inet_diag.o
    
    Fixes: 99a70aa051d2 ("Hexagon: Add processor and system headers")
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Closes: https://lore.kernel.org/oe-kbuild-all/202411091538.PGSTqUBi-lkp@xxxxxxxxx/
    Signed-off-by: Willem de Bruijn <willemb@xxxxxxxxxx>
    Tested-by: Christian Gmeiner <cgmeiner@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241203221736.282020-1-willemdebruijn.kernel@xxxxxxxxx
    Signed-off-by: Brian Cain <bcain@xxxxxxxxxxx>
    Signed-off-by: Brian Cain <brian.cain@xxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h
index 92b8a02e588ac..9c5f07749933e 100644
--- a/arch/hexagon/include/asm/cmpxchg.h
+++ b/arch/hexagon/include/asm/cmpxchg.h
@@ -56,7 +56,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
 	__typeof__(ptr) __ptr = (ptr);				\
 	__typeof__(*(ptr)) __old = (old);			\
 	__typeof__(*(ptr)) __new = (new);			\
-	__typeof__(*(ptr)) __oldval = 0;			\
+	__typeof__(*(ptr)) __oldval = (__typeof__(*(ptr))) 0;	\
 								\
 	asm volatile(						\
 		"1:	%0 = memw_locked(%1);\n"		\




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux