summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index f4f9c9d83694..c604a68f2840 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -913,8 +913,13 @@ static ssize_t get_labels(const char __user *buffer,
max = min(8, maxlen - i);
len = hex32_arg(&buffer[i], max, &tmp);
- if (len <= 0)
+ if (len < 0)
return len;
+
+ /* return empty list in case of invalid input or zero value */
+ if (len == 0 || tmp == 0)
+ return maxlen;
+
pkt_dev->labels[n] = htonl(tmp);
if (pkt_dev->labels[n] & MPLS_STACK_BOTTOM)
pkt_dev->flags |= F_MPLS_RND;