[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e2e85510-f4ad-d983-f76c-b678bc9e397e@gmail.com>
Date: Fri, 8 Apr 2022 16:02:43 +0100
From: Edward Cree <ecree.xilinx@...il.com>
To: Haowen Bai <baihaowen@...zu.com>,
Martin Habets <habetsm.xilinx@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sfc: ef10: Fix assigning negative value to unsigned
variable
On 08/04/2022 03:11, Haowen Bai wrote:
> fix warning reported by smatch:
> 251 drivers/net/ethernet/sfc/ef10.c:2259 efx_ef10_tx_tso_desc()
> warn: assigning (-208) to unsigned variable 'ip_tot_len'
>
> Signed-off-by: Haowen Bai <baihaowen@...zu.com>
> ---
> drivers/net/ethernet/sfc/ef10.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
> index 50d535981a35..1434510dbdc9 100644
> --- a/drivers/net/ethernet/sfc/ef10.c
> +++ b/drivers/net/ethernet/sfc/ef10.c
> @@ -2218,7 +2218,7 @@ int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
> u16 outer_ipv4_id = 0;
> struct tcphdr *tcp;
> struct iphdr *ip;
> - u16 ip_tot_len;
> + s16 ip_tot_len;
The debug-warning on line 2260 relies on this being unsigned; it would
be preferable to change the assignment on the line above to cast the
value to u16, or to assign "0x10000 - EFX_TSO2_MAX_HDRLEN", since that
is the actual semantics of the value.
-ed
> u32 seqnum;
> u32 mss;
>
>
Powered by blists - more mailing lists