Re: [PATCH v2 9/9] RDMA/rxe: Fix types in rxe_icrc.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 06, 2021 at 11:00:41PM -0500, Bob Pearson wrote:
> Currently the ICRC is generated as a u32 type and then forced to a __be32
> and stored into the ICRC field in the packet. The actual type of the ICRC
> is __be32. This patch replaces u32 by __be32 and eliminates the casts.
> The computation is exactly the same as the original but the types are
> more consistent.
> 
> Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx>
> ---
>  drivers/infiniband/sw/rxe/rxe_icrc.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)

Oh, well Ok, it mostly gets fixed up here

>  	shash->tfm = rxe->tfm;
> -	*(u32 *)shash_desc_ctx(shash) = crc;
> +	*(__be32 *)shash_desc_ctx(shash) = crc;
>  	err = crypto_shash_update(shash, next, len);
>  	if (unlikely(err)) {
>  		pr_warn_ratelimited("failed crc calculation, err: %d\n", err);
> -		return crc32_le(crc, next, len);
> +		return (__force __be32)crc32_le((__force u32)crc, next, len);
>  	}

But all this makes my head ache, I'm skeptical it is OK, but isn't any
worse

> @@ -91,7 +91,7 @@ static u32 rxe_icrc_hdr(struct sk_buff *skb, struct rxe_pkt_info *pkt)
>  	/* This seed is the result of computing a CRC with a seed of
>  	 * 0xfffffff and 8 bytes of 0xff representing a masked LRH.
>  	 */
> -	crc = 0xdebb20e3;
> +	crc = (__force __be32)0xdebb20e3;

Eg should this be cpu_to_be32(0xe320bbde) ?

Hard to know without a BE system to check it out on

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux