aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--net/core/pktgen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index fdac61cac1bd..cc07c434948a 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -485,6 +485,9 @@ static ssize_t pgctrl_write(struct file *file, const char __user *buf,
goto out;
}
+ if (count == 0)
+ return -EINVAL;
+
if (count > sizeof(data))
count = sizeof(data);
@@ -492,7 +495,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user *buf,
err = -EFAULT;
goto out;
}
- data[count - 1] = 0; /* Make string */
+ data[count - 1] = 0; /* Strip trailing '\n' and terminate string */
if (!strcmp(data, "stop"))
pktgen_stop_all_threads_ifs(pn);