diff for duplicates of <200905011436.05204.arnd@arndb.de> diff --git a/a/1.txt b/N1/1.txt index 40fc91a..4fa075a 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,34 +1,5 @@ -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 something -based 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 callin -conventions: __put_user needs to know the type of ptr, -so it has to be a macro. - - Arnd <>< +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Ç+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿŸ\a«þG«éÿ¢ž?šèÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢ž?I¥ diff --git a/a/content_digest b/N1/content_digest index fa9b383..49f2961 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -10,39 +10,10 @@ " linux-kernel@vger.kernel.org\0" "\00:1\0" "b\0" - "On Friday 01 May 2009, Michal Simek wrote:\n" - "> > +#ifndef __put_user\n" - "> > +#define __put_user(x, ptr) \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\\n" - "> > +({ \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\\n" - "> > + \302\240 \302\240 \302\240 int __pu_err = 0; \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\\n" - "> > + \302\240 \302\240 \302\240 typeof(*(ptr)) __pu_val = (x); \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\\n" - "> > + \302\240 \302\240 \302\240 switch (sizeof (*(ptr))) { \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\\n" - "> > + \302\240 \302\240 \302\240 case 1: \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\\n" - "> > + \302\240 \302\240 \302\240 case 2: \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\\n" - "> > + \302\240 \302\240 \302\240 case 4: \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\\n" - "> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 *(ptr) = (__pu_val); \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\\n" - "> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 break; \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\\n" - "> > + \302\240 \302\240 \302\240 case 8: \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\\n" - "> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 memcpy(ptr, &__pu_val, sizeof (*(ptr)));\\\n" - "> \n" - "> \n" - "> potential cast problem\n" - "\n" - "Yes, I'm looking into this already, probably will do something\n" - "based on the s390 code, which seems to do this correctly.\n" - "\n" - "> > +#define put_user(x, ptr) ( \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\\n" - "> > + \302\240 \302\240 \302\240 access_ok(VERIFY_WRITE, ptr, sizeof (*ptr)) ? \302\240 \\\n" - "> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 __put_user(x, ptr) : \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\\n" - "> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 -EFAULT)\n" - "> \n" - "> \n" - "> IMHO write it as inline function with type checking.\n" - "\n" - "Unfortunately, this doesn't work because of the callin\n" - "conventions: __put_user needs to know the type of ptr,\n" - "so it has to be a macro.\n" - "\n" - "\tArnd <><" + "On Friday 01 May 2009, Michal Simek wrote:> > +#ifndef __put_user> > +#define __put_user(x, ptr) \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\> > +({ \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\> > + \302\240 \302\240 \302\240 int __pu_err = 0; \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\> > + \302\240 \302\240 \302\240 typeof(*(ptr)) __pu_val = (x); \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\> > + \302\240 \302\240 \302\240 switch (sizeof (*(ptr))) { \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\> > + \302\240 \302\240 \302\240 case 1: \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\> > + \302\240 \302\240 \302\240 case 2: \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\> > + \302\240 \302\240 \302\240 case 4: \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 *(ptr) = (__pu_val); \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 break; \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\> > + \302\240 \302\240 \302\240 case 8: \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 memcpy(ptr, &__pu_val, sizeof (*(ptr)));\\> > > potential cast problem\n" + "Yes, I'm looking into this already, probably will do somethingbased on the s390 code, which seems to do this correctly.\n" + "> > +#define put_user(x, ptr) ( \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \\> > + \302\240 \302\240 \302\240 access_ok(VERIFY_WRITE, ptr, sizeof (*ptr)) ? \302\240 \\> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 __put_user(x, ptr) : \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240\\> > + \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 \302\240 -EFAULT)> > > IMHO write it as inline function with type checking.\n" + "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.\n" + "\tArnd <><\303\277\303\264\303\250\302\272{.n\303\207+\302\211\302\267\302\237\302\256\302\211\302\255\302\206+%\302\212\303\213\303\277\302\261\303\251\303\235\302\266\027\302\245\302\212w\303\277\302\272{.n\303\207+\302\211\302\267\302\245\302\212{\302\261\303\276G\302\253\302\235\303\251\303\277\302\212{ay\302\272\035\303\212\302\207\303\232\302\231\303\253,j\a\302\255\302\242f\302\243\302\242\302\267h\302\232\302\217\303\257\302\201\303\252\303\277\302\221\303\252\303\247z_\303\250\302\256\003(\302\255\303\251\302\232\302\216\302\212\303\235\302\242j\"\302\235\303\272\032\302\266\033m\302\247\303\277\303\277\305\270\a\302\253\303\276G\302\253\302\235\303\251\303\277\302\242\305\276?\302\231\305\241\303\250\302\255\303\232&\302\243\303\270\302\247~\302\217\303\241\302\266iO\302\225\303\246\302\254z\302\267\302\232v\303\230^\024\004\032\302\266\033m\302\247\303\277\303\277\303\203\f\303\277\302\266\303\254\303\277\302\242\305\276?\302\226I\302\245" -0a5fef2f24aefe9559f69bb86060c5430828bbf690e2c60308f6339edb85fab7 +2628e24a6227366141668a39afc14faf28af72223199df636c572806270f4821
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.