Skip to content

Commit 1c3bc2c

Browse files
pseidererkuba-moo
authored andcommitted
net: pktgen: fix 'ratep 0' error handling (return -EINVAL)
Given an invalid 'ratep' command e.g. 'ratep 0' the return value is '1', leading to the following misleading output: - the good case $ echo "ratep 100" > /proc/net/pktgen/lo\@0 $ grep "Result:" /proc/net/pktgen/lo\@0 Result: OK: ratep=100 - the bad case (before the patch) $ echo "ratep 0" > /proc/net/pktgen/lo\@0" -bash: echo: write error: Invalid argument $ grep "Result:" /proc/net/pktgen/lo\@0 Result: No such parameter "atep" - with patch applied $ echo "ratep 0" > /proc/net/pktgen/lo\@0 -bash: echo: write error: Invalid argument $ grep "Result:" /proc/net/pktgen/lo\@0 Result: Idle Signed-off-by: Peter Seiderer <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3ba38c2 commit 1c3bc2c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/pktgen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ static ssize_t pktgen_if_write(struct file *file,
11301130

11311131
i += len;
11321132
if (!value)
1133-
return len;
1133+
return -EINVAL;
11341134
pkt_dev->delay = NSEC_PER_SEC/value;
11351135
if (debug)
11361136
pr_info("Delay set at: %llu ns\n", pkt_dev->delay);

0 commit comments

Comments
 (0)