diff mbox series

[1/1] drivers: net: fix return value check in emac_tso_csum()

Message ID 20230717144621.22870-1-ruc_gongyuanjun@163.com (mailing list archive)
State Accepted
Commit 78a93c31003cc53aca5d67b1bbe2d5b9fc37cc4d
Delegated to: Netdev Maintainers
Headers show
Series [1/1] drivers: net: fix return value check in emac_tso_csum() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1398 this patch: 1398
netdev/cc_maintainers warning 2 maintainers not CCed: kuba@kernel.org pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1422 this patch: 1422
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yuanjun Gong July 17, 2023, 2:46 p.m. UTC
in emac_tso_csum(), return an error code if an unexpected value
is returned by pskb_trim().

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 drivers/net/ethernet/qualcomm/emac/emac-mac.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Kuniyuki Iwashima July 18, 2023, 5:59 p.m. UTC | #1
From: Yuanjun Gong <ruc_gongyuanjun@163.com>
Date: Mon, 17 Jul 2023 22:46:21 +0800
> in emac_tso_csum(), return an error code if an unexpected value
> is returned by pskb_trim().
> 
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>

Fixes: b9b17debc69d ("net: emac: emac gigabit ethernet controller driver")
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>


> ---
>  drivers/net/ethernet/qualcomm/emac/emac-mac.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
> index 0d80447d4d3b..d5c688a8d7be 100644
> --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
> +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
> @@ -1260,8 +1260,11 @@ static int emac_tso_csum(struct emac_adapter *adpt,
>  		if (skb->protocol == htons(ETH_P_IP)) {
>  			u32 pkt_len = ((unsigned char *)ip_hdr(skb) - skb->data)
>  				       + ntohs(ip_hdr(skb)->tot_len);
> -			if (skb->len > pkt_len)
> -				pskb_trim(skb, pkt_len);
> +			if (skb->len > pkt_len) {
> +				ret = pskb_trim(skb, pkt_len);
> +				if (unlikely(ret))
> +					return ret;
> +			}
>  		}
>  
>  		hdr_len = skb_tcp_all_headers(skb);
> -- 
> 2.17.1
patchwork-bot+netdevbpf@kernel.org July 19, 2023, 11:30 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 17 Jul 2023 22:46:21 +0800 you wrote:
> in emac_tso_csum(), return an error code if an unexpected value
> is returned by pskb_trim().
> 
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
>  drivers/net/ethernet/qualcomm/emac/emac-mac.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [1/1] drivers: net: fix return value check in emac_tso_csum()
    https://git.kernel.org/netdev/net/c/78a93c31003c

You are awesome, thank you!
Timur Tabi July 25, 2023, 8:49 p.m. UTC | #3
On Mon, Jul 17, 2023 at 10:02 AM Yuanjun Gong <ruc_gongyuanjun@163.com> wrote:
>
> in emac_tso_csum(), return an error code if an unexpected value
> is returned by pskb_trim().
>
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>

Acked-by: Timur Tabi <timur@kernel.org>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
index 0d80447d4d3b..d5c688a8d7be 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
@@ -1260,8 +1260,11 @@  static int emac_tso_csum(struct emac_adapter *adpt,
 		if (skb->protocol == htons(ETH_P_IP)) {
 			u32 pkt_len = ((unsigned char *)ip_hdr(skb) - skb->data)
 				       + ntohs(ip_hdr(skb)->tot_len);
-			if (skb->len > pkt_len)
-				pskb_trim(skb, pkt_len);
+			if (skb->len > pkt_len) {
+				ret = pskb_trim(skb, pkt_len);
+				if (unlikely(ret))
+					return ret;
+			}
 		}
 
 		hdr_len = skb_tcp_all_headers(skb);