Re: [PATCH 12/27] asm-generic: add a NOMMU uaccess.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 01 May 2009, Michal Simek wrote:> > +#ifndef __put_user> > +#define __put_user(x, ptr)                             \> > +({                                                     \> > +       int __pu_err = 0;                               \> > +       typeof(*(ptr)) __pu_val = (x);                  \> > +       switch (sizeof (*(ptr))) {                      \> > +       case 1:                                         \> > +       case 2:                                         \> > +       case 4:                                         \> > +               *(ptr) = (__pu_val);                    \> > +               break;                                  \> > +       case 8:                                         \> > +               memcpy(ptr, &__pu_val, sizeof (*(ptr)));\> > > potential cast problem
Yes, I'm looking into this already, probably will do somethingbased on the s390 code, which seems to do this correctly.
> > +#define put_user(x, ptr) (                             \> > +       access_ok(VERIFY_WRITE, ptr, sizeof (*ptr)) ?   \> > +               __put_user(x, ptr) :                    \> > +               -EFAULT)> > > IMHO write it as inline function with type checking.
Unfortunately, this doesn't work because of the callinconventions: __put_user needs to know the type of ptr,so it has to be a macro.
	Arnd <><ÿôèº{.nÇ+?·?®?­?+%?Ëÿ±éݶ¥?wÿº{.nÇ+?·¥?{±ýªÜ?ø§¶?¡Üš}©?²Æ zÚ&j:+v?šþø¯ù®w¥þ?à2?Þ?šè­Ú&¢)ß¡«a¶Úÿÿûàz¿äz¹Þ?ú+?ù???Ý¢jÿ?wèþf


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux