From: Brandon Niemczyk <brandon@snprogramming.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] toshiba_acpi check kmalloc return value
Date: Mon, 11 Jul 2005 03:07:00 +0000 [thread overview]
Message-ID: <1121051220.3453.33.camel@localhost> (raw)
In-Reply-To: <1121044844.3554.25.camel@localhost>
[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]
Here it is with the stylistic fixes:
Signed-off-by: Brandon Niemczyk <brandon@snprogramming.com>
--- linux/drivers/acpi/toshiba_acpi.c.orig 2005-07-10 20:40:47.000000000 -0400
+++ linux/drivers/acpi/toshiba_acpi.c 2005-07-10 23:00:43.000000000 -0400
@@ -263,9 +263,11 @@ dispatch_write(struct file* file, const
* destination so that sscanf can be used on it safely.
*/
tmp_buffer = kmalloc(count + 1, GFP_KERNEL);
- if (copy_from_user(tmp_buffer, buffer, count)) {
+
+ if (!tmp_buffer)
+ return -ENOMEM;
+ else if (copy_from_user(tmp_buffer, buffer, count))
result = -EFAULT;
- }
else {
tmp_buffer[count] = 0;
result = item->write_func(tmp_buffer, count);
On Sun, 2005-07-10 at 19:32 -0700, randy_dunlap wrote:
> On Sun, 10 Jul 2005 21:20:44 -0400 Brandon Niemczyk wrote:
> <snip>
> Looks correct functionally, but needs a space after "if", like "if (".
>
> Oh, don't use braces for one-line "blocks".
> Yes the copy_from_user() below does that too. :(
--
Brandon Niemczyk
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2005-07-11 3:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-11 1:20 [KJ] [PATCH] toshiba_acpi check kmalloc return value Brandon Niemczyk
2005-07-11 2:32 ` randy_dunlap
2005-07-11 3:07 ` Brandon Niemczyk [this message]
2005-07-11 9:53 ` walter harms
2005-07-11 11:24 ` Brandon Niemczyk
2005-07-11 13:01 ` Domen Puncer
2005-07-11 15:55 ` walter harms
2005-07-11 17:08 ` Domen Puncer
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=1121051220.3453.33.camel@localhost \
--to=brandon@snprogramming.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.