Skip to content

Commit 4264104

Browse files
arndbgregkh
authored andcommitted
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. Fixes: 5f5bac8 ("mmc: Driver for CB710/720 memory card reader (MMC part)") Cc: stable <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a3e1693 commit 4264104

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/misc/cb710/sgbuf2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static inline bool needs_unaligned_copy(const void *ptr)
4747
#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
4848
return false;
4949
#else
50-
return ((ptr - NULL) & 3) != 0;
50+
return ((uintptr_t)ptr & 3) != 0;
5151
#endif
5252
}
5353

0 commit comments

Comments
 (0)