From: "Peter Kjellerstedt" <peter.kjellerstedt@axis.com>
To: "Jesper Juhl" <juhl-lkml@dif.dk>, "Vincent Hanquez" <tab@snarc.org>
Cc: "linux-kernel" <linux-kernel@vger.kernel.org>,
"Andrew Morton" <akpm@osdl.org>
Subject: RE: [PATCH][4/4] let's kill verify_area - convert kernel/printk.c to access_ok()
Date: Fri, 7 Jan 2005 16:38:30 +0100 [thread overview]
Message-ID: <50BF37ECE4954A4BA18C08D0C2CF88CB010400CD@exmail1.se.axis.com> (raw)
> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org
> [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of
> Vincent Hanquez
> Sent: Friday, January 07, 2005 13:52
> To: Jesper Juhl
> Cc: linux-kernel; Andrew Morton
> Subject: Re: [PATCH][4/4] let's kill verify_area - convert
> kernel/printk.c to access_ok()
>
> On Fri, Jan 07, 2005 at 02:18:55AM +0100, Jesper Juhl wrote:
> > @@ -300,8 +300,8 @@ int do_syslog(int type, char __user * bu
> > error = 0;
> > if (!len)
> > goto out;
> > - error = verify_area(VERIFY_WRITE,buf,len);
> > - if (error)
> > + error = access_ok(VERIFY_WRITE,buf,len);
> > + if (!error)
>
> I would rather put the ! on access_ok
> "if (!error)" is read as "if no error"
Actually, this should be:
error = access_ok(VERIFY_WRITE, buf, len) ? 0 : -EFAULT;
if (error)
goto out;
Alternatively:
if (!access_ok(VERIFY_WRITE, buf, len)) {
error = -EFAULT;
goto out;
}
Otherwise the returned value from do_syslog() is incorrect
in case access_ok() fails (i.e., 0 instead of -EFAULT)...
//Peter
next reply other threads:[~2005-01-07 15:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-07 15:38 Peter Kjellerstedt [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-01-07 1:18 Jesper Juhl
2005-01-07 12:51 ` Vincent Hanquez
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=50BF37ECE4954A4BA18C08D0C2CF88CB010400CD@exmail1.se.axis.com \
--to=peter.kjellerstedt@axis.com \
--cc=akpm@osdl.org \
--cc=juhl-lkml@dif.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=tab@snarc.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
all inboxes | Powered by JetHome®