alistair23-linux/tools/testing/selftests
David Ahern 87caaaf2d1 selftests: Fix get_ifidx and callers in nettest.c
Dan reported:

    The patch acda655fef: "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: acda655fef ("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>
2019-08-16 15:25:34 -07:00
..
android treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
bpf Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2019-08-13 16:24:57 -07:00
breakpoints treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
capabilities selftests: Add test plan API to kselftest.h and adjust callers 2019-04-25 13:15:46 -06:00
cgroup cgroup: kselftest: relax fs_spec checks 2019-08-03 07:02:01 -07:00
cpu-hotplug
cpufreq
drivers selftests: netdevsim: add devlink regions tests 2019-08-15 12:02:44 -07:00
efivarfs treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
exec treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
filesystems
firmware selftests: firmware: Add compressed firmware tests 2019-06-18 09:11:22 +02:00
ftrace The main changes in this release include: 2019-07-18 11:51:00 -07:00
futex treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
gpio treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ia64 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
intel_pstate
ipc
ir
kcmp treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kexec treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kmod selftests: kmod: Fix typo in kmod.sh 2019-07-23 10:45:06 -06:00
kselftest selftests: Remove forced unbuffering for test running 2019-05-21 09:24:30 -06:00
kvm KVM: selftests: Remove superfluous define from vmx.c 2019-07-20 09:00:44 +02:00
lib treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
livepatch selftests/livepatch: push and pop dynamic debug config 2019-07-30 15:47:10 -06:00
locking
media_tests
membarrier treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
memfd
memory-hotplug
mount
mqueue
net selftests: Fix get_ifidx and callers in nettest.c 2019-08-16 15:25:34 -07:00
netfilter Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf 2019-05-23 14:45:36 -07:00
networking/timestamping selftests: timestamping: Fix SIOCGSTAMP undeclared build failure 2019-06-28 14:31:12 -06:00
nsfs treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ntb New feature to add support for NTB virtual MSI interrupts, the ability 2019-07-21 09:46:59 -07:00
pidfd pidfd: remove obsolete comments from test 2019-07-29 17:17:27 +02:00
powerpc powerpc updates for 5.3 2019-07-13 16:08:36 -07:00
prctl
proc proc: test /proc/sysvipc vs setns(CLONE_NEWIPC) 2019-07-16 19:23:21 -07:00
pstore treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 472 2019-06-19 17:09:11 +02:00
ptp selftests: ptp: Add Physical Hardware Clock test 2019-06-13 22:34:55 -07:00
ptrace selftests/ptrace: add a test case for PTRACE_GET_SYSCALL_INFO 2019-07-16 19:23:24 -07:00
rcutorture torture: Suppress propagating trace_printk() warning 2019-05-28 09:06:09 -07:00
rseq rseq/selftests: Fix Thumb mode build failure on arm32 2019-07-08 13:00:41 -06:00
rtc SPDX update for 5.2-rc3, round 1 2019-05-31 08:34:32 -07:00
safesetid LSM: SafeSetID: verify transitive constrainedness 2019-07-15 08:07:51 -07:00
seccomp ptrace: add PTRACE_GET_SYSCALL_INFO request 2019-07-16 19:23:24 -07:00
sigaltstack treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
size treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
sparc64
splice
static_keys treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
sync selftests: Add test plan API to kselftest.h and adjust callers 2019-04-25 13:15:46 -06:00
sysctl treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
tc-testing tc-testing: added tdc tests for matchall filter 2019-08-09 19:59:13 -07:00
timers kselftests: timers: freq-step: Update maximum acceptable precision and errors 2019-06-22 11:28:53 +02:00
tmpfs treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
tpm2
uevent
user treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
vDSO treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 180 2019-05-30 11:29:20 -07:00
vm treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 499 2019-06-19 17:09:53 +02:00
watchdog
x86 selftests/x86: fix spelling mistake "FAILT" -> "FAIL" 2019-07-23 10:45:15 -06:00
zram docs: blockdev: add it to the admin-guide 2019-07-15 11:03:01 -03:00
.gitignore selftests: Extract single-test shell logic from lib.mk 2019-04-25 13:14:13 -06:00
gen_kselftest_tar.sh
kselftest.h kselftest: save-and-restore errno to allow for %m formatting 2019-07-30 15:46:48 -06:00
kselftest_harness.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 481 2019-06-19 17:09:51 +02:00
kselftest_install.sh
kselftest_module.h
kselftest_module.sh
lib.mk kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree 2019-07-11 00:05:09 +09:00
Makefile kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree 2019-07-11 00:05:09 +09:00