Messages in this thread Patch in this message |  | | Date | Sat, 26 Aug 2000 19:17:24 -0300 | Subject | Re: [PATCH] cleanup on selection.c | From | Cesar Eduardo Barros <> |
| |
> In short, avoid it like the plague.
Ugh, I already used it last month, in my nvram.c cleanup patch (but I used it correctly btw). Will you accept if I make a patch to change both uses of copy_*_user_ret into
if (copy_*_user(...)) return -EFAULT;
?
In case the answer is yes, here it is (untested and never compiled as usual, but Obviously Correct):
(you should really add a comment to that's macro definition, btw, so newbies will know to avoid it from day 0)
diff -Naur linux-2.4.0-test7.orig/drivers/char/nvram.c linux-2.4.0-test7/drivers/char/nvram.c --- linux-2.4.0-test7.orig/drivers/char/nvram.c Sat Aug 26 15:36:25 2000 +++ linux-2.4.0-test7/drivers/char/nvram.c Sat Aug 26 19:15:10 2000 @@ -246,7 +246,8 @@ spin_unlock_irq (&rtc_lock); - copy_to_user_ret (buf, contents, tmp - contents, -EFAULT); + if (copy_to_user (buf, contents, tmp - contents)) + return -EFAULT; *ppos = i; @@ -264,10 +265,9 @@ unsigned i = *ppos; char * tmp; - /* could comebody please help me indent this better? */ - copy_from_user_ret (contents, buf, (NVRAM_BYTES - i) < count ? - (NVRAM_BYTES - i) : count, - -EFAULT); + if (copy_from_user (contents, buf, (NVRAM_BYTES - i) < count ? + (NVRAM_BYTES - i) : count)) + return -EFAULT; spin_lock_irq (&rtc_lock); -- Cesar Eduardo Barros cesarb@nitnet.com.br cesarb@dcc.ufrj.br - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |