diff options
author | David Ahern <dsahern@gmail.com> | 2019-08-14 19:11:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-08-17 00:25:34 +0200 |
commit | 87caaaf2d19d4656924241aadb612782c296928f (patch) | |
tree | 531917b94ad1a18d8e7ba53007063b77d3e715e1 /drivers/net | |
parent | net: dsa: mv88e6xxx: check for mode change in port_setup_mac (diff) | |
download | linux-87caaaf2d19d4656924241aadb612782c296928f.tar.xz linux-87caaaf2d19d4656924241aadb612782c296928f.zip |
selftests: Fix get_ifidx and callers in nettest.c
Dan reported:
The patch acda655fefae: "selftests: Add nettest" from Aug 1, 2019,
leads to the following static checker warning:
./tools/testing/selftests/net/nettest.c:1690 main()
warn: unsigned 'tmp' is never less than zero.
./tools/testing/selftests/net/nettest.c
1680 case '1':
1681 args.has_expected_raddr = 1;
1682 if (convert_addr(&args, optarg,
1683 ADDR_TYPE_EXPECTED_REMOTE))
1684 return 1;
1685
1686 break;
1687 case '2':
1688 if (str_to_uint(optarg, 0, 0x7ffffff, &tmp) != 0) {
1689 tmp = get_ifidx(optarg);
1690 if (tmp < 0) {
"tmp" is unsigned so it can't be negative. Also all the callers assume
that get_ifidx() returns negatives on error but it looks like it really
returns zero on error so it's a bit unclear to me.
Update get_ifidx to return -1 on errors and cleanup callers of it.
Fixes: acda655fefae ("selftests: Add nettest")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
0 files changed, 0 insertions, 0 deletions