From: Brian Norris <computersforpeace@gmail.com>
To: Wang Haitao <wang.haitao1@zte.com.cn>
Cc: artem.bityutskiy@linux.intel.com, linux-mtd@lists.infradead.org,
dwmw2@infradead.org
Subject: Re: [PATCH]mtd: map: fixed bug in 64-bit systems
Date: Wed, 21 Aug 2013 01:57:58 -0700 [thread overview]
Message-ID: <20130821085758.GG31788@brian-ubuntu> (raw)
In-Reply-To: <5201f818.42ceb40a.21ae.ffffaa90SMTPIN_ADDED_BROKEN@mx.google.com>
Hi Wang,
Can you please resend this patch with a few fixups?
The description below is good, but please wrap it to ~70 characters. It
is hard to read.
Also, you need to test your patch with scripts/checkpatch.pl both before
and after you email it -- all your whitespace is mangled (i.e., you use
spaces where there should be tabs).
See the kernel documentation:
Documentation/SubmittingPatches
Documentation/email-clients.txt
On Wed, Aug 07, 2013 at 03:34:20PM +0800, Wang Haitao wrote:
> Hardware:
> CPU:XLP832,the 64-bit OS
> NOR Flash:S29GL128S 128M
> Software:
> Kernel:2.6.32.41
> Filesystem:JFFS2
>
> When writing files, errors appear:
> Write len 182 but return retlen 180
> Write of 182 bytes at 0x072c815c failed. returned -5, retlen 180
> Write len 186 but return retlen 184
> Write of 186 bytes at 0x072caff4 failed. returned -5, retlen 184
> These errors exist only in 64-bit systems,not in 32-bit systems. After analysis, we found that the left shift operation is wrong in map_word_load_partial. For instance:
> unsigned char buf[3] ={0x9e,0x3a,0xea};
> map_bankwidth(map) is 4;
>
> for (i=0; i < 3; i++) {
> int bitpos;
> bitpos = (map_bankwidth(map)-1-i)*8;
> orig.x[0] &= ~(0xff << bitpos);
> orig.x[0] |= buf[i] << bitpos;
> }
>
> The value of orig.x[0] is expected to be 0x9e3aeaff, but in this situation(64-bit System) we'll get the wrong value of 0xffffffff9e3aeaff due to the 64-bit sign extension:
> buf[i] is defined as "unsigned char" and the left-shift operation will convert it to the type of "signed int", so when left-shift buf[i] by 24 bits, the final result will get the wrong value: 0xffffffff9e3aeaff.
>
> If the left-shift bits are less than 24, then sign extension will not occur. Whereas the bankwidth of the nor flash we used is 4, therefore this BUG emerges.
>
> Signed-off-by:Pang Xunlei <pang.xunlei@zte.com.cn>
> Signed-off-by: Zhang Yi <zhang.yi20@zte.com.cn>
> Signed-off-by:Lu Zhongjun <lu.zhongjun@zte.com.cn>
> Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
> Tested-by: Ma Chenggong <ma.chenggong@zte.com.cn>
[...]
Thanks,
Brian
next parent reply other threads:[~2013-08-21 8:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5201f818.42ceb40a.21ae.ffffaa90SMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-21 8:57 ` Brian Norris [this message]
2013-08-22 11:32 ` [PATCH]mtd: map: fixed bug in 64-bit systems Wang Haitao
2013-08-23 2:24 ` Wang Haitao
2013-10-23 1:43 ` Brian Norris
2013-08-07 7:34 Wang Haitao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130821085758.GG31788@brian-ubuntu \
--to=computersforpeace@gmail.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=wang.haitao1@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.