aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/pktgen.c')
-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,
485 goto out; 485 goto out;
486 } 486 }
487 487
488 if (count == 0)
489 return -EINVAL;
490
488 if (count > sizeof(data)) 491 if (count > sizeof(data))
489 count = sizeof(data); 492 count = sizeof(data);
490 493
@@ -492,7 +495,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user *buf,
492 err = -EFAULT; 495 err = -EFAULT;
493 goto out; 496 goto out;
494 } 497 }
495 data[count - 1] = 0; /* Make string */ 498 data[count - 1] = 0; /* Strip trailing '\n' and terminate string */
496 499
497 if (!strcmp(data, "stop")) 500 if (!strcmp(data, "stop"))
498 pktgen_stop_all_threads_ifs(pn); 501 pktgen_stop_all_threads_ifs(pn);