Message ID | 20250213111920.1439021-7-ps.report@gmx.net (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Some pktgen fixes/improvments (part II) | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/apply | fail | Patch does not apply to net-next-1 |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 780435a8e605..1a0cfff2f3d7 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -925,8 +925,13 @@ static ssize_t get_labels(const char __user *buffer, max = min(HEX_8_DIGITS, 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;