Skip to content

Commit b963f23

Browse files
keithbuschDinh Nguyen
authored andcommitted
nios2: fix __wsum type degradation in csum_fold()
csum_fold() shifts a bitwise __wsum type, which sparse reports as "restricted __wsum degrades to integer". Sparse only checks the body of a static inline once something instantiates it, so this went unnoticed until a recent block layer change added the first csum_fold() caller to a file built on this architecture. Force cast to a __u32 for the shift, as the other architectures do. Fixes: eea9507 ("nios2: Library functions") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202609222053.5gjiJjtb-lkp@intel.com/ Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
1 parent cee9395 commit b963f23

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎arch/nios2/include/asm/checksum.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static inline __sum16 csum_fold(__wsum sum)
2727
"add %0, %0, r8\n"
2828
"nor %0, %0, %0\n"
2929
: "=r" (sum)
30-
: "r" (sum << 16), "0" (sum)
30+
: "r" ((__force u32)sum << 16), "0" (sum)
3131
: "r8");
3232
return (__force __sum16) sum;
3333
}

0 commit comments

Comments
 (0)