linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] sfc: ef10: Fix assigning negative value to unsigned variable
@ 2022-04-11  1:32 Haowen Bai
  2022-04-11 16:27 ` Edward Cree
  2022-04-12  4:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Haowen Bai @ 2022-04-11  1:32 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>
---
V1->V2: to assign "0x10000 - EFX_TSO2_MAX_HDRLEN" is the actual 
semantics of the value.

 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..c9ee5011803f 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -2256,7 +2256,7 @@ int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
 	 * guaranteed to satisfy the second as we only attempt TSO if
 	 * inner_network_header <= 208.
 	 */
-	ip_tot_len = -EFX_TSO2_MAX_HDRLEN;
+	ip_tot_len = 0x10000 - EFX_TSO2_MAX_HDRLEN;
 	EFX_WARN_ON_ONCE_PARANOID(mss + EFX_TSO2_MAX_HDRLEN +
 				  (tcp->doff << 2u) > ip_tot_len);
 
-- 
2.7.4


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

* Re: [PATCH V2] sfc: ef10: Fix assigning negative value to unsigned variable
  2022-04-11  1:32 [PATCH V2] sfc: ef10: Fix assigning negative value to unsigned variable Haowen Bai
@ 2022-04-11 16:27 ` Edward Cree
  2022-04-12  4:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Edward Cree @ 2022-04-11 16:27 UTC (permalink / raw)
  To: Haowen Bai, Martin Habets, David S. Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel

On 11/04/2022 02:32, 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>
> ---
Acked-by: Edward Cree <ecree.xilinx@gmail.com>

> V1->V2: to assign "0x10000 - EFX_TSO2_MAX_HDRLEN" is the actual 
> semantics of the value.
> 
>  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..c9ee5011803f 100644
> --- a/drivers/net/ethernet/sfc/ef10.c
> +++ b/drivers/net/ethernet/sfc/ef10.c
> @@ -2256,7 +2256,7 @@ int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
>  	 * guaranteed to satisfy the second as we only attempt TSO if
>  	 * inner_network_header <= 208.
>  	 */
> -	ip_tot_len = -EFX_TSO2_MAX_HDRLEN;
> +	ip_tot_len = 0x10000 - EFX_TSO2_MAX_HDRLEN;
>  	EFX_WARN_ON_ONCE_PARANOID(mss + EFX_TSO2_MAX_HDRLEN +
>  				  (tcp->doff << 2u) > ip_tot_len);
>  
> 


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

* Re: [PATCH V2] sfc: ef10: Fix assigning negative value to unsigned variable
  2022-04-11  1:32 [PATCH V2] sfc: ef10: Fix assigning negative value to unsigned variable Haowen Bai
  2022-04-11 16:27 ` Edward Cree
@ 2022-04-12  4:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-12  4:00 UTC (permalink / raw)
  To: Haowen Bai
  Cc: ecree.xilinx, habetsm.xilinx, davem, kuba, pabeni, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 11 Apr 2022 09:32:37 +0800 you 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>
> ---
> V1->V2: to assign "0x10000 - EFX_TSO2_MAX_HDRLEN" is the actual
> semantics of the value.
> 
> [...]

Here is the summary with links:
  - [V2] sfc: ef10: Fix assigning negative value to unsigned variable
    https://git.kernel.org/netdev/net-next/c/b8ff3395fbdf

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-04-12  4:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11  1:32 [PATCH V2] sfc: ef10: Fix assigning negative value to unsigned variable Haowen Bai
2022-04-11 16:27 ` Edward Cree
2022-04-12  4:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).