patch "cb710: avoid NULL pointer subtraction" added to char-misc-linus
This is a note to let you know that I've just added the patch titled
cb710: avoid NULL pointer subtraction
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 42641042c10c757fe10cc09088cf3f436cec5007 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Mon, 27 Sep 2021 14:13:57 +0200
Subject: cb710: avoid NULL pointer subtraction
clang-14 complains about an unusual way of converting a pointer to an integer:
drivers/misc/cb710/sgbuf2.c:50:15: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
return ((ptr - NULL) & 3) != 0;
Replace this with a normal cast to uintptr_t.
--- drivers/misc/cb710/sgbuf2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cb710/sgbuf2.c +1 -1
@@ -47,7 +47,7 @@ static inline bool needs_unaligned_copy(const void *ptr)#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS return false;#else -return ((ptr -NULL ) &3 ) !=0 ; +return ((uintptr_t )ptr &3 ) !=0 ;#endif }
Signature · 1 line
2.33.0