Skip to contentSkip to conversation

misc: cxl: delete possible null pointer dereference

PATCH Superseded zhong jiang 2 participants 3 messages Oct 4, 2018 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 misc: cxl: delete possible null pointer dereference

It is safe to dereference an object below a NULL test. For the sake of debugging. Just delete the call of possible null pointer dereference.

---
 drivers/misc/cxl/guest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/guest.c +1 -1
index 3bc0c15..472e8db 100644
@@ -1018,7 +1018,7 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n
 
 void cxl_guest_remove_afu(struct cxl_afu *afu)
 {
-	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
+	pr_devel("in %s\n", __func__);
 
 	if (!afu)
 		return;
Signature · 1 line
1.7.12.4
maintainer
#1 lore raw
Quoted 13 lines · zhong jiang

It is safe to dereference an object below a NULL test. For the sake of debugging. Just delete the call of possible null pointer dereference.

---
 drivers/misc/cxl/guest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/guest.c +0 -0
index 3bc0c15..472e8db 100644

drivers/misc/cxl/guest.c int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n · line 1021

Quoted 5 lines
drivers/misc/cxl/guest.c +1 -1
@@ -1018,7 +1018,7 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n
 
 void cxl_guest_remove_afu(struct cxl_afu *afu)
 {
-	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
+	pr_devel("in %s\n", __func__);

This call should just be deleted, it's not needed, ftrace can be used instead.

thanks,

greg k-h

#2 lore raw
Quoted 15 lines · Greg KH
Quoted 14 lines · zhong jiang

It is safe to dereference an object below a NULL test. For the sake of debugging. Just delete the call of possible null pointer dereference.

---
 drivers/misc/cxl/guest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/guest.c +0 -0
index 3bc0c15..472e8db 100644
@@ -1018,7 +1018,7 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n
 
Quoted 6 lines

drivers/misc/cxl/guest.c int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n · line 1021

Quoted 4 lines
drivers/misc/cxl/guest.c +1 -1
 void cxl_guest_remove_afu(struct cxl_afu *afu)
 {
-	pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
+	pr_devel("in %s\n", __func__);

This call should just be deleted, it's not needed, ftrace can be used instead.

Fine. Will do.

Sincerely,
zhong jiang

Quoted 6 lines

thanks,

greg k-h

.