提交 0a5549ed 编写于 作者: A Arnd Bergmann

lib/checksum: fix one more thinko

When do_csum gets unaligned data, we really need to treat
the first byte as an even byte, not an odd byte, because
we swap the two halves later.

Found by Mike's checksum-selftest module.
Reported-by: NMike Frysinger <vapier.adi@gmail.com>
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
上级 20c1f641
......@@ -57,9 +57,9 @@ static unsigned int do_csum(const unsigned char *buff, int len)
odd = 1 & (unsigned long) buff;
if (odd) {
#ifdef __LITTLE_ENDIAN
result = *buff;
#else
result += (*buff << 8);
#else
result = *buff;
#endif
len--;
buff++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册