From: Michal Nazarewicz <mina86@mina86.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] usb: gadget: f_fs: check for allocation failure
Date: Fri, 24 Jun 2016 20:20:46 +0000 [thread overview]
Message-ID: <xa1twple49up.fsf@mina86.com> (raw)
In-Reply-To: <20160624122316.GB23169@mwanda>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 1121 bytes --]
On Fri, Jun 24 2016, Dan Carpenter wrote:
> Return -ENOMEM if kmalloc() fails.
>
> Fixes: 9353afbbfa7b ('usb: gadget: f_fs: buffer data from ‘oversized’ OUT requests')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> index a91fcb0..5c8429f 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -775,6 +775,8 @@ static ssize_t __ffs_epfile_read_data(struct ffs_epfile *epfile,
>
> data_len -= ret;
> buf = kmalloc(sizeof(*buf) + data_len, GFP_KERNEL);
> + if (!buf)
> + return -ENOMEM;
> buf->length = data_len;
> buf->data = buf->storage;
> memcpy(buf->storage, data + ret, data_len);
--
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2016-06-24 20:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 12:23 [patch] usb: gadget: f_fs: check for allocation failure Dan Carpenter
2016-06-24 20:20 ` Michal Nazarewicz [this message]
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=xa1twple49up.fsf@mina86.com \
--to=mina86@mina86.com \
--cc=kernel-janitors@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.