public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Guo Zhengkui <guozhengkui@vivo.com>
Cc: Alan Stern <stern@rowland.harvard.edu>, Li Jun <jun.li@nxp.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Peter Chen <peter.chen@nxp.com>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	kernel@vivo.com
Subject: Re: [PATCH] usb: core: hcd: fix bug: application of sizeof to pointer
Date: Tue, 7 Dec 2021 15:40:37 +0100	[thread overview]
Message-ID: <Ya9yZX3JsuO8OcVJ@kroah.com> (raw)
In-Reply-To: <20211207135401.5507-1-guozhengkui@vivo.com>

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

  reply	other threads:[~2021-12-07 14:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 13:53 [PATCH] usb: core: hcd: fix bug: application of sizeof to pointer Guo Zhengkui
2021-12-07 14:40 ` Greg Kroah-Hartman [this message]
2021-12-07 22:21   ` Alan Stern
2021-12-08  5:43     ` Greg Kroah-Hartman
2021-12-09  6:23     ` [PATCH] usb: core: hcd: change sizeof(vaddr) to sizeof(unsigned long) Guo Zhengkui
     [not found]   ` <AJkA6AAaE4s5AAqOmmsZjapb.9.1638915668969.Hmail.guozhengkui@vivo.com.@PFlhL2VVYmROMStBQkZWV2ZAcm93bGFuZC5oYXJ2YXJkLmVkdT4=>
2021-12-08  3:00     ` [PATCH] usb: core: hcd: fix bug: application of sizeof to pointer Guo Zhengkui
2021-12-08 21:36       ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ya9yZX3JsuO8OcVJ@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=guozhengkui@vivo.com \
    --cc=jun.li@nxp.com \
    --cc=kernel@vivo.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@nxp.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox