All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: csum: cast to the proper type
@ 2021-03-15  1:26 ` Alex Elder
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Elder @ 2021-03-15  1:26 UTC (permalink / raw)
  To: catalin.marinas, will, robin.murphy; +Cc: linux-arm-kernel, linux-kernel

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@linaro.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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] arm64: csum: cast to the proper type
@ 2021-03-15  1:26 ` Alex Elder
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Elder @ 2021-03-15  1:26 UTC (permalink / raw)
  To: catalin.marinas, will, robin.murphy; +Cc: linux-arm-kernel, linux-kernel

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@linaro.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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm64: csum: cast to the proper type
  2021-03-15  1:26 ` Alex Elder
@ 2021-03-15 10:41   ` Robin Murphy
  -1 siblings, 0 replies; 6+ messages in thread
From: Robin Murphy @ 2021-03-15 10:41 UTC (permalink / raw)
  To: Alex Elder, catalin.marinas, will; +Cc: linux-arm-kernel, linux-kernel

On 2021-03-15 01:26, Alex Elder wrote:
> 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.

Oddly, the commit adding the cast does specifically speak about 
converting to __wsum, so I'm not sure what happened there... :/

Anyway, this seems to make sense.

Acked-by: Robin Murphy <robin.murphy@arm.com>

> Signed-off-by: Alex Elder <elder@linaro.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
>   
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm64: csum: cast to the proper type
@ 2021-03-15 10:41   ` Robin Murphy
  0 siblings, 0 replies; 6+ messages in thread
From: Robin Murphy @ 2021-03-15 10:41 UTC (permalink / raw)
  To: Alex Elder, catalin.marinas, will; +Cc: linux-arm-kernel, linux-kernel

On 2021-03-15 01:26, Alex Elder wrote:
> 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.

Oddly, the commit adding the cast does specifically speak about 
converting to __wsum, so I'm not sure what happened there... :/

Anyway, this seems to make sense.

Acked-by: Robin Murphy <robin.murphy@arm.com>

> Signed-off-by: Alex Elder <elder@linaro.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
>   
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm64: csum: cast to the proper type
  2021-03-15  1:26 ` Alex Elder
@ 2021-03-15 11:08   ` Will Deacon
  -1 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2021-03-15 11:08 UTC (permalink / raw)
  To: catalin.marinas, robin.murphy, Alex Elder
  Cc: kernel-team, Will Deacon, linux-kernel, linux-arm-kernel

On Sun, 14 Mar 2021 20:26:50 -0500, Alex Elder wrote:
> 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.

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: csum: cast to the proper type
      https://git.kernel.org/arm64/c/0710442a88d1

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm64: csum: cast to the proper type
@ 2021-03-15 11:08   ` Will Deacon
  0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2021-03-15 11:08 UTC (permalink / raw)
  To: catalin.marinas, robin.murphy, Alex Elder
  Cc: kernel-team, Will Deacon, linux-kernel, linux-arm-kernel

On Sun, 14 Mar 2021 20:26:50 -0500, Alex Elder wrote:
> 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.

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: csum: cast to the proper type
      https://git.kernel.org/arm64/c/0710442a88d1

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-15 11:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15  1:26 [PATCH] arm64: csum: cast to the proper type Alex Elder
2021-03-15  1:26 ` Alex Elder
2021-03-15 10:41 ` Robin Murphy
2021-03-15 10:41   ` Robin Murphy
2021-03-15 11:08 ` Will Deacon
2021-03-15 11:08   ` Will Deacon

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.