From: Oliver Neukum <oneukum@suse.de>
To: Jiri Kosina <jkosina@suse.cz>
Cc: James Woodcock <James.Woodcock@aculab.com>, linux-input@vger.kernel.org
Subject: Re: possible missing error handling in hidraw
Date: Fri, 27 Apr 2012 11:26:54 +0200 [thread overview]
Message-ID: <201204271126.55061.oneukum@suse.de> (raw)
In-Reply-To: <alpine.LNX.2.00.1204270946490.1856@pobox.suse.cz>
Am Freitag, 27. April 2012, 09:47:55 schrieb Jiri Kosina:
> -void hidraw_report_event(struct hid_device *hid, u8 *data, int len)
> +int hidraw_report_event(struct hid_device *hid, u8 *data, int len)
> {
> struct hidraw *dev = hid->hidraw;
> struct hidraw_list *list;
> + int ret = 0;
>
> list_for_each_entry(list, &dev->list, node) {
> - list->buffer[list->head].value = kmemdup(data, len, GFP_ATOMIC);
> + if (!(list->buffer[list->head].value = kmemdup(data, len, GFP_ATOMIC))) {
> + ret = -ENOMEM;
> + break;
> + }
> list->buffer[list->head].len = len;
> list->head = (list->head + 1) & (HIDRAW_BUFFER_SIZE - 1);
> kill_fasync(&list->fasync, SIGIO, POLL_IN);
> }
>
> wake_up_interruptible(&dev->wait);
> + return ret;
> }
Then I have to ask why not simply copy the rest of the entries?
Regards
Oliver
next prev parent reply other threads:[~2012-04-27 10:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 13:12 possible missing error handling in hidraw Oliver Neukum
2012-04-26 22:56 ` Jiri Kosina
2012-04-27 7:36 ` James Woodcock
2012-04-27 7:47 ` Jiri Kosina
2012-04-27 9:26 ` Oliver Neukum [this message]
2012-04-27 12:35 ` Jiri Kosina
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=201204271126.55061.oneukum@suse.de \
--to=oneukum@suse.de \
--cc=James.Woodcock@aculab.com \
--cc=jkosina@suse.cz \
--cc=linux-input@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).