[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180824102723.zvzeaf26q6x7o3ms@mwanda>
Date: Fri, 24 Aug 2018 13:27:24 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Ding Xiang <dingxiang@...s.chinamobile.com>
Cc: johan@...nel.org, elder@...nel.org, gregkh@...uxfoundation.org,
greybus-dev@...ts.linaro.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: greybus: Fix null pointer dereference
On Fri, Aug 24, 2018 at 12:07:11AM -0400, Ding Xiang wrote:
> If fw is null then fw->size will trigger null pointer dereference
>
> Signed-off-by: Ding Xiang <dingxiang@...s.chinamobile.com>
> ---
> drivers/staging/greybus/bootrom.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
> index e85ffae..3af28a0 100644
> --- a/drivers/staging/greybus/bootrom.c
> +++ b/drivers/staging/greybus/bootrom.c
> @@ -297,7 +297,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
>
> queue_work:
> /* Refresh timeout */
> - if (!ret && (offset + size == fw->size))
> + if (!ret && fw && (offset + size == fw->size))
That is impossible. If "ret" is zero that implies "fw" is a valid
pointer.
regards,
dan carpenter
Powered by blists - more mailing lists