Skip to contentSkip to conversation

misc: cxl: Fix possible null pointer dereference

PATCH RESEND In review zhong jiang 3 participants 3 messages Oct 4, 2018 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 misc: cxl: Fix possible null pointer dereference

It is not safe to dereference an object before a null test. It is not needed and just remove them. Ftrace can be used instead.

---
 drivers/misc/cxl/guest.c | 2 --
 1 file changed, 2 deletions(-)
drivers/misc/cxl/guest.c +0 -2
index 3bc0c15..5d28d9e 100644
@@ -1018,8 +1018,6 @@ 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);
-
 	if (!afu)
 		return;
 
Signature · 1 line
1.7.12.4
Acked-by on v2 1/1
#1 lore raw

Le 04/10/2018 à 07:02, zhong jiang a écrit :

Quoted 5 lines

It is not safe to dereference an object before a null test. It is not needed and just remove them. Ftrace can be used instead.

---

Quoted 16 lines
  drivers/misc/cxl/guest.c | 2 --
  1 file changed, 2 deletions(-)
drivers/misc/cxl/guest.c +0 -2
index 3bc0c15..5d28d9e 100644
@@ -1018,8 +1018,6 @@ 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);
-
  	if (!afu)
  		return;
 
Acked-by on v2 1/1
#2 lore raw
In reply to zhong jiang
Quoted 4 lines · zhong jiang

It is not safe to dereference an object before a null test. It is not needed and just remove them. Ftrace can be used instead.

Quoted 18 lines
---
  drivers/misc/cxl/guest.c | 2 --
  1 file changed, 2 deletions(-)
drivers/misc/cxl/guest.c +0 -2
index 3bc0c15..5d28d9e 100644
@@ -1018,8 +1018,6 @@ 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);
-
  	if (!afu)
  		return;
 
Signature · 2 lines
Andrew Donnellan              OzLabs, ADL Canberra
[email protected]  IBM Australia Limited