mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Alex Elder <elder@linaro.org>, catalin.marinas@arm.com, will@kernel.org
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: csum: cast to the proper type
Date: Mon, 15 Mar 2021 10:41:52 +0000	[thread overview]
Message-ID: <031a3734-c677-5d42-2329-81f5f6ba1cfe@arm.com> (raw)
In-Reply-To: <20210315012650.1221328-1-elder@linaro.org>

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
>   
> 

  reply	other threads:[~2021-03-15 10:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15  1:26 Alex Elder
2021-03-15 10:41 ` Robin Murphy [this message]
2021-03-15 11:08 ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=031a3734-c677-5d42-2329-81f5f6ba1cfe@arm.com \
    --to=robin.murphy@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=elder@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®