[PATCH net-next v4 10/17] net: pktgen: remove extra tmp variable (re-use len instead)

Peter Seiderer
2025-02-05T13:12:06Z

Remove extra tmp variable in pktgen_if_write (re-use len instead).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
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 --git a/net/core/pktgen.c b/net/core/pktgen.c
index 279910367ad4..91b06473c925 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -966,7 +966,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]);
@@ -977,12 +976,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 */

--
2.48.1