* [PATCH] sfc: ef10: Fix assigning negative value to unsigned variable
@ 2022-04-08 2:11 Haowen Bai
2022-04-08 15:02 ` Edward Cree
0 siblings, 1 reply; 2+ messages in thread
From: Haowen Bai @ 2022-04-08 2:11 UTC (permalink / raw)
To: Edward Cree, Martin Habets, David S. Miller, Jakub Kicinski, Paolo Abeni
Cc: Haowen Bai, netdev, linux-kernel
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@meizu.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;
u32 seqnum;
u32 mss;
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sfc: ef10: Fix assigning negative value to unsigned variable
2022-04-08 2:11 [PATCH] sfc: ef10: Fix assigning negative value to unsigned variable Haowen Bai
@ 2022-04-08 15:02 ` Edward Cree
0 siblings, 0 replies; 2+ messages in thread
From: Edward Cree @ 2022-04-08 15:02 UTC (permalink / raw)
To: Haowen Bai, Martin Habets, David S. Miller, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel
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@meizu.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;
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-08 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08 2:11 [PATCH] sfc: ef10: Fix assigning negative value to unsigned variable Haowen Bai
2022-04-08 15:02 ` Edward Cree
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®