[PATCH] lkdtm: cfi: use NULL for a null pointer rather than zero

Colin Ian King posted 1 patch 3 years, 10 months ago
drivers/misc/lkdtm/cfi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] lkdtm: cfi: use NULL for a null pointer rather than zero
Posted by Colin Ian King 3 years, 10 months ago
There is a pointer being initialized with a zero, use NULL instead.

Cleans up sparse warning:
drivers/misc/lkdtm/cfi.c:100:27: warning: Using plain integer as NULL pointer

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/misc/lkdtm/cfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm/cfi.c b/drivers/misc/lkdtm/cfi.c
index 666a7f4bc137..71483cb1e422 100644
--- a/drivers/misc/lkdtm/cfi.c
+++ b/drivers/misc/lkdtm/cfi.c
@@ -97,7 +97,7 @@ static volatile int force_check;
 static void lkdtm_CFI_BACKWARD(void)
 {
 	/* Use calculated gotos to keep labels addressable. */
-	void *labels[] = {0, &&normal, &&redirected, &&check_normal, &&check_redirected};
+	void *labels[] = { NULL, &&normal, &&redirected, &&check_normal, &&check_redirected };
 
 	pr_info("Attempting unchecked stack return address redirection ...\n");
 
-- 
2.35.3
Re: [PATCH] lkdtm: cfi: use NULL for a null pointer rather than zero
Posted by Kees Cook 3 years, 10 months ago
On Sun, Jun 12, 2022 at 09:27:08PM +0100, Colin Ian King wrote:
> There is a pointer being initialized with a zero, use NULL instead.
> 
> Cleans up sparse warning:
> drivers/misc/lkdtm/cfi.c:100:27: warning: Using plain integer as NULL pointer
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Acked-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook