[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VE1PR04MB6687C23030FD3C59BA5EC1EE8F120@VE1PR04MB6687.eurprd04.prod.outlook.com>
Date: Fri, 21 Feb 2020 23:18:38 +0000
From: Leo Li <leoyang.li@....com>
To: Colin King <colin.king@...onical.com>,
Roy Pledge <roy.pledge@....com>,
Youri Querry <youri.querry_1@....com>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
CC: "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH][next] soc: fsl: dpio: fix dereference of pointer p before
null check
> -----Original Message-----
> From: Colin King <colin.king@...onical.com>
> Sent: Friday, February 21, 2020 5:12 PM
> To: Roy Pledge <roy.pledge@....com>; Leo Li <leoyang.li@....com>; Youri
> Querry <youri.querry_1@....com>; linuxppc-dev@...ts.ozlabs.org; linux-
> arm-kernel@...ts.infradead.org
> Cc: kernel-janitors@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: [PATCH][next] soc: fsl: dpio: fix dereference of pointer p before null
> check
>
> From: Colin Ian King <colin.king@...onical.com>
>
> Pointer p is currently being dereferenced before it is null checked on a
> memory allocation failure check. Fix this by checking if p is null before
> dereferencing it.
>
> Addresses-Coverity: ("Dereference before null check")
> Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring
> mode enqueue")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
Applied for next. Thanks.
> ---
> drivers/soc/fsl/dpio/qbman-portal.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/fsl/dpio/qbman-portal.c
> b/drivers/soc/fsl/dpio/qbman-portal.c
> index 740ee0d19582..d1f49caa5b13 100644
> --- a/drivers/soc/fsl/dpio/qbman-portal.c
> +++ b/drivers/soc/fsl/dpio/qbman-portal.c
> @@ -249,10 +249,11 @@ struct qbman_swp *qbman_swp_init(const struct
> qbman_swp_desc *d)
> u32 mask_size;
> u32 eqcr_pi;
>
> - spin_lock_init(&p->access_spinlock);
> -
> if (!p)
> return NULL;
> +
> + spin_lock_init(&p->access_spinlock);
> +
> p->desc = d;
> p->mc.valid_bit = QB_VALID_BIT;
> p->sdq = 0;
> --
> 2.25.0
Powered by blists - more mailing lists