From: Clemens Ladisch <clemens@ladisch.de>
To: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: core: Do not use sizeof on pointer type
Date: Fri, 22 Apr 2016 08:53:34 +0200 [thread overview]
Message-ID: <5719CA6E.1070809@ladisch.de> (raw)
In-Reply-To: <1461304310-4808-1-git-send-email-vaishali.thakkar@oracle.com>
Vaishali Thakkar wrote:
> When sizeof is applied to a pointer typed expression, it gives
> the size of the pointer.
And why would that be wrong in this case?
> +++ b/drivers/usb/core/hcd.c
> @@ -1386,7 +1386,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),
> mem_flags, dma_handle);
> if (!vaddr)
> return -ENOMEM;
>
Please note the following comment:
/*
* Store the virtual address of the buffer at the end
* of the allocated dma buffer. [...]
Regards,
Clemens
next prev parent reply other threads:[~2016-04-22 6:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 5:51 [PATCH] usb: core: Do not use sizeof on pointer type Vaishali Thakkar
2016-04-22 6:53 ` Clemens Ladisch [this message]
2016-04-22 6:57 ` Bjørn Mork
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=5719CA6E.1070809@ladisch.de \
--to=clemens@ladisch.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=vaishali.thakkar@oracle.com \
/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