diff mbox series

[1/1] drivers:net: fix return value check in ocelot_fdma_receive_skb

Message ID 20230717144652.23408-1-ruc_gongyuanjun@163.com (mailing list archive)
State Accepted
Commit bce5603365d8184734ba7e6b22e74bd2c90a7167
Delegated to: Netdev Maintainers
Headers show
Series [1/1] drivers:net: fix return value check in ocelot_fdma_receive_skb | 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: 1342 this patch: 1342
netdev/cc_maintainers warning 5 maintainers not CCed: kuba@kernel.org UNGLinuxDriver@microchip.com davem@davemloft.net pabeni@redhat.com edumazet@google.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: 1365 this patch: 1365
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 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
ocelot_fdma_receive_skb should return false if an unexpected
value is returned by pskb_trim.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 drivers/net/ethernet/mscc/ocelot_fdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kuniyuki Iwashima July 18, 2023, 5:55 p.m. UTC | #1
From: Yuanjun Gong <ruc_gongyuanjun@163.com>
Date: Mon, 17 Jul 2023 22:46:52 +0800
> ocelot_fdma_receive_skb should return false if an unexpected
> value is returned by pskb_trim.
> 
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>

Fixes: 753a026cfec1 ("net: ocelot: add FDMA support")
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>


> ---
>  drivers/net/ethernet/mscc/ocelot_fdma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot_fdma.c b/drivers/net/ethernet/mscc/ocelot_fdma.c
> index 8e3894cf5f7c..83a3ce0c568e 100644
> --- a/drivers/net/ethernet/mscc/ocelot_fdma.c
> +++ b/drivers/net/ethernet/mscc/ocelot_fdma.c
> @@ -368,7 +368,8 @@ static bool ocelot_fdma_receive_skb(struct ocelot *ocelot, struct sk_buff *skb)
>  	if (unlikely(!ndev))
>  		return false;
>  
> -	pskb_trim(skb, skb->len - ETH_FCS_LEN);
> +	if (pskb_trim(skb, skb->len - ETH_FCS_LEN))
> +		return false;
>  
>  	skb->dev = ndev;
>  	skb->protocol = eth_type_trans(skb, skb->dev);
> -- 
> 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:52 +0800 you wrote:
> ocelot_fdma_receive_skb should return false if an unexpected
> value is returned by pskb_trim.
> 
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
>  drivers/net/ethernet/mscc/ocelot_fdma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [1/1] drivers:net: fix return value check in ocelot_fdma_receive_skb
    https://git.kernel.org/netdev/net/c/bce5603365d8

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mscc/ocelot_fdma.c b/drivers/net/ethernet/mscc/ocelot_fdma.c
index 8e3894cf5f7c..83a3ce0c568e 100644
--- a/drivers/net/ethernet/mscc/ocelot_fdma.c
+++ b/drivers/net/ethernet/mscc/ocelot_fdma.c
@@ -368,7 +368,8 @@  static bool ocelot_fdma_receive_skb(struct ocelot *ocelot, struct sk_buff *skb)
 	if (unlikely(!ndev))
 		return false;
 
-	pskb_trim(skb, skb->len - ETH_FCS_LEN);
+	if (pskb_trim(skb, skb->len - ETH_FCS_LEN))
+		return false;
 
 	skb->dev = ndev;
 	skb->protocol = eth_type_trans(skb, skb->dev);