lkml.org 
[lkml]   [2021]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: core: hcd: fix bug: application of sizeof to pointer
On Tue, Dec 07, 2021 at 09:53:47PM +0800, Guo Zhengkui wrote:
> Fix following error:
> ./drivers/usb/core/hcd.c:1284:38-44: ERROR:
> application of sizeof to pointer.

What generated this error?

>
> Use sizeof(*vaddr) instead.
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> ---
> drivers/usb/core/hcd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index 4d326ee12c36..996d5273cf60 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -1281,7 +1281,7 @@ static int hcd_alloc_coherent(struct usb_bus *bus,
> return -EFAULT;
> }
>
> - vaddr = hcd_buffer_alloc(bus, size + sizeof(vaddr),
> + vaddr = hcd_buffer_alloc(bus, size + sizeof(*vaddr),

I think you just broke the code.

Look at this closer and see what the function is doing with this buffer
and if you still think your patch is correct, please rewrite the
changelog text to explain why it is so (hint, just using the output of
coccinelle isn't ok.)

thanks,

greg k-h

\
 
 \ /
  Last update: 2021-12-07 15:41    [W:0.068 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site