diff mbox series

[net-next,v7,2/8] net: pktgen: remove extra tmp variable (re-use len instead)

Message ID 20250224092242.13192-3-ps.report@gmx.net (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series Some pktgen fixes/improvments (part II) | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
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: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
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: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2025-02-24--12-00 (tests: 895)

Commit Message

Peter Seiderer Feb. 24, 2025, 9:22 a.m. UTC
Remove extra tmp variable in pktgen_if_write (re-use len instead).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Simon Horman <horms@kernel.org>
---
Changes v6 -> v7
  - rebased on actual net-next/main
  - no changes

Changes v5 -> v6
  - no changes

Changes v4 -> v5
  - split up patchset into part i/ii (suggested by Simon Horman)
  - add rev-by Simon Horman

Changes v3 -> v4
  - new patch (factored out of patch 'net: pktgen: fix access outside of user
    given buffer in pktgen_if_write()')
---
 net/core/pktgen.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index cd6b6c0dc0dc..b97a94cb85ac 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -961,7 +961,6 @@  static ssize_t pktgen_if_write(struct file *file,
 	char name[16], valstr[32];
 	unsigned long value = 0;
 	char *pg_result = NULL;
-	int tmp = 0;
 	char buf[128];
 
 	pg_result = &(pkt_dev->result[0]);
@@ -972,12 +971,12 @@  static ssize_t pktgen_if_write(struct file *file,
 	}
 
 	max = count;
-	tmp = count_trail_chars(user_buffer, max);
-	if (tmp < 0) {
+	len = count_trail_chars(user_buffer, max);
+	if (len < 0) {
 		pr_warn("illegal format\n");
-		return tmp;
+		return len;
 	}
-	i = tmp;
+	i = len;
 
 	/* Read variable name */