Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1299276 > unrolled thread
| Started by | "Pathak, Rahul (R.)" <rpathak@visteon.com> |
|---|---|
| First post | 2015-12-30 10:20 +0100 |
| Last post | 2015-12-30 10:20 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2 RESEND] usb: Use memdup_user to reuse the code "Pathak, Rahul (R.)" <rpathak@visteon.com> - 2015-12-30 10:20 +0100
| From | "Pathak, Rahul (R.)" <rpathak@visteon.com> |
|---|---|
| Date | 2015-12-30 10:20 +0100 |
| Subject | Re: [PATCH v2 RESEND] usb: Use memdup_user to reuse the code |
| Message-ID | <qLl5g-4Hy-3@gated-at.bofh.it> |
Hello Greg,
This patch is not yet merged, its already been reviewed and acked by Alan.
Thanks
Rahul
On Thu, Dec 10, 2015 at 09:40:33PM -0800, Rahul Pathak wrote:
> From: Rahul Pathak <rpathak@visteon.com>
>
> Fixing coccicheck warning which recommends to use memdup_user instead
> to reimplement its code, using memdup_user simplifies the code
>
> ./drivers/usb/core/devio.c:1398:11-18: WARNING opportunity for memdup_user
>
>
> Signed-off-by: Rahul Pathak <rpathak@visteon.com>
>
> ---
>
> Changes after v1: setting isopkt=NULL for proper kfree() call
>
> ---
> drivers/usb/core/devio.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index 38ae877c..844407c 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -1395,11 +1395,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
> number_of_packets = uurb->number_of_packets;
> isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
> number_of_packets;
> - isopkt = kmalloc(isofrmlen, GFP_KERNEL);
> - if (!isopkt)
> - return -ENOMEM;
> - if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
> - ret = -EFAULT;
> + isopkt = memdup_user(iso_frame_desc, isofrmlen);
> + if (IS_ERR(isopkt)) {
> + ret = PTR_ERR(isopkt);
> + isopkt = NULL;
> goto error;
> }
> for (totlen = u = 0; u < number_of_packets; u++) {
> --
> 1.9.1--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web