[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210315012650.1221328-1-elder@linaro.org>
Date: Sun, 14 Mar 2021 20:26:50 -0500
From: Alex Elder <elder@...aro.org>
To: catalin.marinas@....com, will@...nel.org, robin.murphy@....com
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] arm64: csum: cast to the proper type
The last line of ip_fast_csum() calls csum_fold(), forcing the
type of the argument passed to be u32. But csum_fold() takes a
__wsum argument (which is __u32 __bitwise for arm64). As long
as we're forcing the cast, cast it to the right type.
Signed-off-by: Alex Elder <elder@...aro.org>
---
With this patch in place, quite a few "different base types" sparse
warnings go away on a full arm64 kernel build. More specifically:
warning: incorrect type in argument 1 (different base types)
expected restricted __wsum [usertype] csum
got unsigned int [usertype]
-Alex
arch/arm64/include/asm/checksum.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/checksum.h b/arch/arm64/include/asm/checksum.h
index 93a161b3bf3fe..dc52b733675db 100644
--- a/arch/arm64/include/asm/checksum.h
+++ b/arch/arm64/include/asm/checksum.h
@@ -37,7 +37,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
} while (--n > 0);
sum += ((sum >> 32) | (sum << 32));
- return csum_fold((__force u32)(sum >> 32));
+ return csum_fold((__force __wsum)(sum >> 32));
}
#define ip_fast_csum ip_fast_csum
--
2.27.0
Powered by blists - more mailing lists