summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_log_format.h
diff options
context:
space:
mode:
authorWang Haitao <wang.haitao1@zte.com.cn>2013-08-22 11:32:38 (GMT)
committerBrian Norris <computersforpeace@gmail.com>2013-11-07 07:32:59 (GMT)
commita4d62babf988fe5dfde24437fa135ef147bc7aa0 (patch)
tree6f34c5f7eaafcb6d76273845ebfaeb88bc377f20 /fs/xfs/xfs_log_format.h
parentf83c3838b9146b891d0405d3a83660e8f6aed02f (diff)
downloadlinux-fsl-qoriq-a4d62babf988fe5dfde24437fa135ef147bc7aa0.tar.xz
mtd: map: fixed bug in 64-bit systems
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> Cc: <stable@vger.kernel.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'fs/xfs/xfs_log_format.h')
0 files changed, 0 insertions, 0 deletions