Message ID | 20250224092242.13192-7-ps.report@gmx.net (mailing list archive) |
---|---|
State | New |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Some pktgen fixes/improvments (part II) | expand |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index ae5e81e62733..bb13a4591709 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -915,8 +915,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 and/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;