[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200224063529.GA3286@kadam>
Date: Mon, 24 Feb 2020 09:35:29 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Colin King <colin.king@...onical.com>
Cc: Roy Pledge <Roy.Pledge@....com>, Li Yang <leoyang.li@....com>,
Youri Querry <youri.querry_1@....com>,
linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...ts.infradead.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] soc: fsl: dpio: fix dereference of pointer p
before null check
On Fri, Feb 21, 2020 at 11:11:43PM +0000, Colin King wrote:
> ---
> 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);
Allocations in the declaration blog are not super common in the kernel,
but they're more bug prone. Generally, it's not beautiful to call a
function which can fail in the allocation block.
regards,
dan carpenter
Powered by blists - more mailing lists