Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752811AbYGUPsz (ORCPT ); Mon, 21 Jul 2008 11:48:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751061AbYGUPsr (ORCPT ); Mon, 21 Jul 2008 11:48:47 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.122]:59030 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbYGUPsq (ORCPT ); Mon, 21 Jul 2008 11:48:46 -0400 Date: Mon, 21 Jul 2008 11:48:38 -0400 Message-ID: <87abgbgrvt.wl%ysato@users.sourceforge.jp> From: Yoshinori Sato To: OGAWA Hirofumi Cc: Andrew Morton , lkml Subject: Re: [PATCH] filldir write data missing size In-Reply-To: <87r69pk51q.fsf@devron.myhome.or.jp> References: <87k5fi4l49.wl%ysato@users.sourceforge.jp> <871w1pn5wz.fsf@devron.myhome.or.jp> <87iqv1wwy1.wl%ysato@users.sourceforge.jp> <87r69pk51q.fsf@devron.myhome.or.jp> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.2 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1431 Lines: 49 At Sun, 20 Jul 2008 05:11:29 +0900, OGAWA Hirofumi wrote: > > Yoshinori Sato writes: > > >> > - if (__put_user(offset, &dirent->d_off)) > >> > + if (__put_user((unsigned long)offset, &dirent->d_off)) > >> > >> Um.. __put_user() should be already doing it automatically.. > > > > I'm mistake. > > > > I checked object, and found bad code. > > This problem fix __put_user. > > Um.. Could you explain the detail of problem? Is this a workaround or > something for the bug of some compiler? If so, shouldn't we fix > __put_user() instead of caller? > > E.g. the following or something fixes it? (btw, this is for x86) > > #define __put_user(x, ptr) ({ \ > /* Since some compiler generates wrong code, we need __v.?? */ \ > __typeof__(*(ptr)) __v = (x); \ > __put_user_nocheck(__v, (ptr), sizeof(*(ptr))); \ > }) > -- > OGAWA Hirofumi This problem is sh-linux-gcc v4.1.2 and target sh2(a)-bigendian. "__put_user(s64, u32_ptr)" compiled. Correct code. *u32_ptr = s64 & 0xffffffff; Bad code. *u32_ptr = s64 >> 32; I'm add cast put_user 4byte case. -- Yoshinori Sato -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/