* [PATCH][4/4] let's kill verify_area - convert kernel/printk.c to access_ok()
@ 2005-01-07 1:18 Jesper Juhl
2005-01-07 12:51 ` Vincent Hanquez
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2005-01-07 1:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton
Here's a patch to convert verify_area to access_ok in kernel/printk.c
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
diff -up linux-2.6.10-bk9-orig/kernel/printk.c linux-2.6.10-bk9/kernel/printk.c
--- linux-2.6.10-bk9-orig/kernel/printk.c 2004-12-24 22:35:40.000000000 +0100
+++ linux-2.6.10-bk9/kernel/printk.c 2005-01-07 02:11:16.000000000 +0100
@@ -269,8 +269,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)
goto out;
error = wait_event_interruptible(log_wait, (log_start - log_end));
if (error)
@@ -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)
goto out;
count = len;
if (count > log_buf_len)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][4/4] let's kill verify_area - convert kernel/printk.c to access_ok()
2005-01-07 1:18 [PATCH][4/4] let's kill verify_area - convert kernel/printk.c to access_ok() Jesper Juhl
@ 2005-01-07 12:51 ` Vincent Hanquez
0 siblings, 0 replies; 3+ messages in thread
From: Vincent Hanquez @ 2005-01-07 12:51 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel, Andrew Morton
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"
--
Vincent Hanquez
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH][4/4] let's kill verify_area - convert kernel/printk.c to access_ok()
@ 2005-01-07 15:38 Peter Kjellerstedt
0 siblings, 0 replies; 3+ messages in thread
From: Peter Kjellerstedt @ 2005-01-07 15:38 UTC (permalink / raw)
To: Jesper Juhl, Vincent Hanquez; +Cc: linux-kernel, Andrew Morton
> -----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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-01-07 15:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-07 1:18 [PATCH][4/4] let's kill verify_area - convert kernel/printk.c to access_ok() Jesper Juhl
2005-01-07 12:51 ` Vincent Hanquez
2005-01-07 15:38 Peter Kjellerstedt
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).