diff mbox series

[net-next] net: remove redundant check in skb_shift()

Message ID 1723730983-22912-1-git-send-email-zhangchangzhong@huawei.com (mailing list archive)
State Accepted
Commit dca9d62a0d7684a5510645ba05960529c5066457
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: remove redundant check in skb_shift() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
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: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 29 this patch: 29
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: 29 this patch: 29
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 54 this patch: 54
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-16--21-00 (tests: 710)

Commit Message

Zhang Changzhong Aug. 15, 2024, 2:09 p.m. UTC
The check for '!to' is redundant here, since skb_can_coalesce() already
contains this check.

Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 net/core/skbuff.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Simon Horman Aug. 16, 2024, 10:49 a.m. UTC | #1
On Thu, Aug 15, 2024 at 10:09:42PM +0800, Zhang Changzhong wrote:
> The check for '!to' is redundant here, since skb_can_coalesce() already
> contains this check.

It would be nice to mention here how this was found (e.g. found by
inspection, flagged by private static analysis tool, ...) and how it was
tested (e.g. compile tested only).

> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>

In any case, this looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>
patchwork-bot+netdevbpf@kernel.org Aug. 20, 2024, 1:30 a.m. UTC | #2
Hello:

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

On Thu, 15 Aug 2024 22:09:42 +0800 you wrote:
> The check for '!to' is redundant here, since skb_can_coalesce() already
> contains this check.
> 
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> ---
>  net/core/skbuff.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Here is the summary with links:
  - [net-next] net: remove redundant check in skb_shift()
    https://git.kernel.org/netdev/net-next/c/dca9d62a0d76

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 83f8cd8..f915234 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4169,8 +4169,7 @@  int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
 	/* Actual merge is delayed until the point when we know we can
 	 * commit all, so that we don't have to undo partial changes
 	 */
-	if (!to ||
-	    !skb_can_coalesce(tgt, to, skb_frag_page(fragfrom),
+	if (!skb_can_coalesce(tgt, to, skb_frag_page(fragfrom),
 			      skb_frag_off(fragfrom))) {
 		merge = -1;
 	} else {