From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 12/27] asm-generic: add a NOMMU uaccess.h Date: Fri, 1 May 2009 14:36:04 +0200 Message-ID: <200905011436.05204.arnd@arndb.de> References: <45b4644e80c27b9d042b3960e3d99f0d444e0d92.1241105648.git.arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: base64 Return-path: Received: from moutng.kundenserver.de ([212.227.126.188]:56832 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751815AbZEAMgM (ORCPT ); Fri, 1 May 2009 08:36:12 -0400 In-Reply-To: Content-Disposition: inline Sender: linux-arch-owner@vger.kernel.org List-ID: To: Michal Simek Cc: linux-arch@vger.kernel.org, Remis Lima Baima , linux-kernel@vger.kernel.org T24gRnJpZGF5IDAxIE1heSAyMDA5LCBNaWNoYWwgU2ltZWsgd3JvdGU6Cj4gPiArI2lmbmRlZiBf X3B1dF91c2VyCj4gPiArI2RlZmluZSBfX3B1dF91c2VyKHgsIHB0cikgoCCgIKAgoCCgIKAgoCCg IKAgoCCgIKAgoCCgIFwKPiA+ICsoeyCgIKAgoCCgIKAgoCCgIKAgoCCgIKAgoCCgIKAgoCCgIKAg oCCgIKAgoCCgIKAgoCCgIKAgXAo+ID4gKyCgIKAgoCBpbnQgX19wdV9lcnIgPSAwOyCgIKAgoCCg IKAgoCCgIKAgoCCgIKAgoCCgIKAgoCBcCj4gPiArIKAgoCCgIHR5cGVvZigqKHB0cikpIF9fcHVf dmFsID0gKHgpOyCgIKAgoCCgIKAgoCCgIKAgoFwKPiA+ICsgoCCgIKAgc3dpdGNoIChzaXplb2Yg KCoocHRyKSkpIHsgoCCgIKAgoCCgIKAgoCCgIKAgoCCgXAo+ID4gKyCgIKAgoCBjYXNlIDE6IKAg oCCgIKAgoCCgIKAgoCCgIKAgoCCgIKAgoCCgIKAgoCCgIKAgoCBcCj4gPiArIK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0aCB0eXBlIGNoZWNraW5nLgoKVW5mb3J0dW5hdGVs eSwgdGhpcyBkb2Vzbid0IHdvcmsgYmVjYXVzZSBvZiB0aGUgY2FsbGluCmNvbnZlbnRpb25zOiBf X3B1dF91c2VyIG5lZWRzIHRvIGtub3cgdGhlIHR5cGUgb2YgcHRyLApzbyBpdCBoYXMgdG8gYmUg YSBtYWNyby4KCglBcm5kIDw+PAo= From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757638AbZEAMgW (ORCPT ); Fri, 1 May 2009 08:36:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752620AbZEAMgN (ORCPT ); Fri, 1 May 2009 08:36:13 -0400 Received: from moutng.kundenserver.de ([212.227.126.188]:56832 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751815AbZEAMgM (ORCPT ); Fri, 1 May 2009 08:36:12 -0400 From: Arnd Bergmann To: Michal Simek Subject: Re: [PATCH 12/27] asm-generic: add a NOMMU uaccess.h Date: Fri, 1 May 2009 14:36:04 +0200 User-Agent: KMail/1.9.9 Cc: linux-arch@vger.kernel.org, Remis Lima Baima , linux-kernel@vger.kernel.org References: <45b4644e80c27b9d042b3960e3d99f0d444e0d92.1241105648.git.arnd@arndb.de> In-Reply-To: X-Face: I@=L^?./?$U,EK.)V[4*>`zSqm0>65YtkOe>TFD'!aw?7OVv#~5xd\s,[~w]-J!)|%=]>=?utf-8?q?+=0A=09=7EohchhkRGW=3F=7C6=5FqTmkd=5Ft=3FLZC=23Q-=60=2E=60Y=2Ea=5E?= =?utf-8?q?3zb?=) =?utf-8?q?+U-JVN=5DWT=25cw=23=5BYo0=267C=26bL12wWGlZi=0A=09=7EJ=3B=5Cwg?= =?utf-8?q?=3B3zRnz?=,J"CT_)=\H'1/{?SR7GDu?WIopm.HaBG=QYj"NZD_[zrM\Gip^U MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Message-Id: <200905011436.05204.arnd@arndb.de> X-Provags-ID: V01U2FsdGVkX18IvMJj7n5ZLJ1hPgr2b0pk7W87TgyXBarRRoC N+CXt37DET2fbNgNn4iITzWcudg6Mxy5RT5QbXOZEGd9e/Ii4J ZjiMZO9os78bMQkzVjilQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by alpha.home.local id n41CaRqu010708 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Ç+‰·¥Š{±þG«éÿŠ{ayºʇڙë,j­¢f£¢·hšïêÿ‘êçz_è®(­éšŽŠÝ¢j"ú¶m§ÿÿ¾«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^¶m§ÿÿà ÿ¶ìÿ¢¸?–I¥