[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y5gYQZ3iA/k9EPJn@kroah.com>
Date: Tue, 13 Dec 2022 07:14:25 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc: neal_liu@...eedtech.com, joel@....id.au, andrew@...id.au,
sumit.semwal@...aro.org, christian.koenig@....com,
linux-aspeed@...ts.ozlabs.org, linux-usb@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linaro-mm-sig@...ts.linaro.org
Subject: Re: [PATCH] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent
On Tue, Dec 13, 2022 at 10:51:19AM +0800, Jiasheng Jiang wrote:
> Add the check for the return value of dma_alloc_coherent
> in order to avoid NULL pointer dereference.
>
> Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> ---
> drivers/usb/gadget/udc/aspeed_udc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
> index 01968e2167f9..6cf46562bb25 100644
> --- a/drivers/usb/gadget/udc/aspeed_udc.c
> +++ b/drivers/usb/gadget/udc/aspeed_udc.c
> @@ -1516,6 +1516,8 @@ static int ast_udc_probe(struct platform_device *pdev)
> AST_UDC_EP_DMA_SIZE *
> AST_UDC_NUM_ENDPOINTS,
> &udc->ep0_buf_dma, GFP_KERNEL);
> + if (!udc->ep0_buf)
> + return -ENOMEM;
How did you test this? I ask as it is obviously not correct. Please
always test your patches before submitting them as adding new bugs when
claiming that you are fixing a problem is not good.
And how did you find this potential problem? What tool did you use and
why did you not follow the documentation for properly describing the
tool?
thanks,
greg k-h
Powered by blists - more mailing lists