Patch "MIPS: BCM47XX: Cast memcmp() of function to (void *)" has been added to the 6.0-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

    MIPS: BCM47XX: Cast memcmp() of function to (void *)

to the 6.0-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:
     mips-bcm47xx-cast-memcmp-of-function-to-void.patch
and it can be found in the queue-6.0 subdirectory.

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



commit 467d08e54d1cb28313222ac4e9d961b52e8ab630
Author: Kees Cook <keescook@xxxxxxxxxxxx>
Date:   Wed Sep 7 16:05:56 2022 -0700

    MIPS: BCM47XX: Cast memcmp() of function to (void *)
    
    [ Upstream commit 0dedcf6e3301836eb70cfa649052e7ce4fcd13ba ]
    
    Clang is especially sensitive about argument type matching when using
    __overloaded functions (like memcmp(), etc). Help it see that function
    pointers are just "void *". Avoids this error:
    
    arch/mips/bcm47xx/prom.c:89:8: error: no matching function for call to 'memcmp'
                       if (!memcmp(prom_init, prom_init + mem, 32))
                            ^~~~~~
    include/linux/string.h:156:12: note: candidate function not viable: no known conversion from 'void (void)' to 'const void *' for 1st argument extern int memcmp(const void *,const void *,__kernel_size_t);
    
    Cc: Hauke Mehrtens <hauke@xxxxxxxxxx>
    Cc: "Rafał Miłecki" <zajec5@xxxxxxxxx>
    Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
    Cc: linux-mips@xxxxxxxxxxxxxxx
    Cc: Nathan Chancellor <nathan@xxxxxxxxxx>
    Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
    Cc: llvm@xxxxxxxxxxxxxxx
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Link: https://lore.kernel.org/lkml/202209080652.sz2d68e5-lkp@xxxxxxxxx
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index ab203e66ba0d..a9bea411d928 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -86,7 +86,7 @@ static __init void prom_init_mem(void)
 			pr_debug("Assume 128MB RAM\n");
 			break;
 		}
-		if (!memcmp(prom_init, prom_init + mem, 32))
+		if (!memcmp((void *)prom_init, (void *)prom_init + mem, 32))
 			break;
 	}
 	lowmem = mem;
@@ -159,7 +159,7 @@ void __init bcm47xx_prom_highmem_init(void)
 
 	off = EXTVBASE + __pa(off);
 	for (extmem = 128 << 20; extmem < 512 << 20; extmem <<= 1) {
-		if (!memcmp(prom_init, (void *)(off + extmem), 16))
+		if (!memcmp((void *)prom_init, (void *)(off + extmem), 16))
 			break;
 	}
 	extmem -= lowmem;



[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