summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2021-09-27 14:13:57 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-20 10:42:03 +0200
commitcf79c98d528ee1b7c3b4e915fff434f6192664e0 (patch)
tree2ca6cc6af26200885a6b658b41b44a7dc853a2c9 /drivers/misc
parentbf979fa5d0eb8345a48f577a53abc74374fa213f (diff)
downloadlinux-stable-cf79c98d528ee1b7c3b4e915fff434f6192664e0.tar.gz
linux-stable-cf79c98d528ee1b7c3b4e915fff434f6192664e0.tar.bz2
linux-stable-cf79c98d528ee1b7c3b4e915fff434f6192664e0.zip
cb710: avoid NULL pointer subtraction
commit 42641042c10c757fe10cc09088cf3f436cec5007 upstream. 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. Fixes: 5f5bac8272be ("mmc: Driver for CB710/720 memory card reader (MMC part)") Cc: stable <stable@vger.kernel.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20210927121408.939246-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/cb710/sgbuf2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/cb710/sgbuf2.c b/drivers/misc/cb710/sgbuf2.c
index 2a40d0efdff5..4d2a72a537d4 100644
--- a/drivers/misc/cb710/sgbuf2.c
+++ b/drivers/misc/cb710/sgbuf2.c
@@ -50,7 +50,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
}