get_u8() returns -1 on failure, so the "< -1" test never fires and "encaplimit 300" stores an uninitialised byte. Test for any error. Fixes: 288384f22ffa ("TUNNEL: IPv6-over-IPv6 tunnel support.") Fixes: 9d0efc10487b ("ip: add support of 'ip link type ip6tnl'") Signed-off-by: Andrii Tereshchenko --- encaplimit 300: was an uninitialised byte, now invalid ELIM. ip/ip6tunnel.c | 2 +- ip/link_ip6tnl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c index 347bd46a..68517b40 100644 --- a/ip/ip6tunnel.c +++ b/ip/ip6tunnel.c @@ -181,7 +181,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p) } else { __u8 uval; - if (get_u8(&uval, *argv, 0) < -1) + if (get_u8(&uval, *argv, 0)) invarg("invalid ELIM", *argv); p->encap_limit = uval; p->flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT; diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index c2a05cee..1809c8c1 100644 --- a/ip/link_ip6tnl.c +++ b/ip/link_ip6tnl.c @@ -195,7 +195,7 @@ static int ip6tunnel_parse_opt(struct link_util *lu, int argc, char **argv, } else { __u8 uval; - if (get_u8(&uval, *argv, 0) < -1) + if (get_u8(&uval, *argv, 0)) invarg("invalid ELIM", *argv); encap_limit = uval; flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT; base-commit: 06b62d179bbb5b62cba965dcda48a613dbc59416 -- 2.53.0