2018-10-04 05:15:56

by zhong jiang

[permalink] [raw]
Subject: [RESEND PATCHv2] 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.

Signed-off-by: zhong jiang <[email protected]>
---
drivers/misc/cxl/guest.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
index 3bc0c15..5d28d9e 100644
--- a/drivers/misc/cxl/guest.c
+++ b/drivers/misc/cxl/guest.c
@@ -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;

--
1.7.12.4



2018-10-04 11:48:37

by Frederic Barrat

[permalink] [raw]
Subject: Re: [RESEND PATCHv2] misc: cxl: Fix possible null pointer dereference



Le 04/10/2018 à 07:02, zhong jiang a écrit :
> 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.
>
> Signed-off-by: zhong jiang <[email protected]>
> ---

Acked-by: Frederic Barrat <[email protected]>


> drivers/misc/cxl/guest.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
> index 3bc0c15..5d28d9e 100644
> --- a/drivers/misc/cxl/guest.c
> +++ b/drivers/misc/cxl/guest.c
> @@ -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;
>


2018-10-04 11:59:44

by Andrew Donnellan

[permalink] [raw]
Subject: Re: [RESEND PATCHv2] misc: cxl: Fix possible null pointer dereference

On 4/10/18 3:02 pm, zhong jiang wrote:
> 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.
>
> Signed-off-by: zhong jiang <[email protected]>

Acked-by: Andrew Donnellan <[email protected]>

> ---
> drivers/misc/cxl/guest.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
> index 3bc0c15..5d28d9e 100644
> --- a/drivers/misc/cxl/guest.c
> +++ b/drivers/misc/cxl/guest.c
> @@ -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;
>
>

--
Andrew Donnellan OzLabs, ADL Canberra
[email protected] IBM Australia Limited