linux/tools/testing/selftests
Willem de Bruijn c3e974e9c4 selftests/net: mptcp: fix uninitialized variable warnings
[ Upstream commit 00a4f8fd9c ]

Same init_rng() in both tests. The function reads /dev/urandom to
initialize srand(). In case of failure, it falls back onto the
entropy in the uninitialized variable. Not sure if this is on purpose.
But failure reading urandom should be rare, so just fail hard. While
at it, convert to getrandom(). Which man 4 random suggests is simpler
and more robust.

    mptcp_inq.c:525:6:
    mptcp_connect.c:1131:6:

    error: variable 'foo' is used uninitialized
    whenever 'if' condition is false
    [-Werror,-Wsometimes-uninitialized]

Fixes: 048d19d444 ("mptcp: add basic kselftest for mptcp")
Fixes: b51880568f ("selftests: mptcp: add inq test case")
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>

----

When input is randomized because this is expected to meaningfully
explore edge cases, should we also add
1. logging the random seed to stdout and
2. adding a command line argument to replay from a specific seed
I can do this in net-next, if authors find it useful in this case.
Reviewed-by: Matthieu Baerts <matttbe@kernel.org>

Link: https://lore.kernel.org/r/20231124171645.1011043-5-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-08 08:51:17 +01:00
..
alsa
amd-pstate
arm64
bpf selftests/bpf: Correct map_fd to data_fd in tailcalls 2023-11-20 11:51:51 +01:00
breakpoints
capabilities
cgroup selftests: cgroup: fix unexpected failure on test_memcg_low 2023-07-19 16:21:08 +02:00
clone3
core
cpu-hotplug
cpufreq
damon
dma
dmabuf-heaps
drivers selftests: bonding: do not set port down before adding to bond 2023-08-30 16:11:02 +02:00
efivarfs selftests/efivarfs: create-read: fix a resource leak 2023-11-28 17:06:58 +00:00
exec
filesystems
firmware
fpu
ftrace selftests/ftrace: Add new test case which checks non unique symbol 2023-10-25 12:03:15 +02:00
futex selftests/futex: Order calls to futex_lock_pi 2023-09-13 09:42:29 +02:00
gpio selftests: gpio: gpio-sim: Fix BUG: test FAILED due to recent change 2023-06-21 16:00:52 +02:00
ia64
intel_pstate
ipc
ir
kcmp
kexec
kmod
kselftest kselftest/runner.sh: Propagate SIGTERM to runner child 2023-09-19 12:28:08 +02:00
kvm
landlock
lib
livepatch
lkdtm selftests/lkdtm: Disable CONFIG_UBSAN_TRAP in test config 2023-11-28 17:06:54 +00:00
locking
media_tests
membarrier
memfd selftests/memfd: Fix unknown type name build failure 2023-05-30 14:03:19 +01:00
memory-hotplug
mincore
mount
mount_setattr selftests/mount_setattr: fix redefine struct mount_attr build error 2023-06-28 11:12:21 +02:00
move_mount_set_group
mqueue
nci
net selftests/net: mptcp: fix uninitialized variable warnings 2023-12-08 08:51:17 +01:00
netfilter net: skb_find_text: Ignore patterns extending past 'to' 2023-11-20 11:51:54 +01:00
nolibc selftests/nolibc: fix up kernel parameters support 2023-09-23 11:11:00 +02:00
nsfs
ntb
openat2
perf_events
pid_namespace
pidfd selftests/pidfd: Fix ksft print formats 2023-11-20 11:52:03 +01:00
powerpc selftests/powerpc: Fix emit_tests to work with run_kselftest.sh 2023-10-06 14:56:49 +02:00
prctl
proc
pstore
ptp selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET 2023-06-21 16:01:02 +02:00
ptrace
rcutorture rcutorture: Correct name of use_softirq module parameter 2023-07-19 16:21:01 +02:00
resctrl selftests/resctrl: Reduce failures due to outliers in MBA/MBM tests 2023-11-28 17:07:13 +00:00
rlimits
rseq selftests/rseq: Fix build with undefined __weak 2023-08-16 18:27:25 +02:00
rtc
safesetid
sched
seccomp
sgx
sigaltstack
size
sparc64
splice
static_keys
sync
syscall_user_dispatch
sysctl
tc-testing net/sched: Retire rsvp classifier 2023-09-23 11:11:13 +02:00
timens
timers
tmpfs
tpm2
uevent
user
user_events
vDSO kselftest: vDSO: Fix accumulation of uninitialized ret when CLOCK_REALTIME is undefined 2023-07-19 16:21:02 +02:00
vm selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and hugetlb_reparenting_test.sh that may cause error 2023-10-25 12:03:08 +02:00
watchdog
wireguard wireguard: netlink: send staged packets when setting initial private key 2023-07-19 16:22:17 +02:00
x86
zram
.gitignore
gen_kselftest_tar.sh
kselftest_deps.sh selftests: fix dependency checker script 2023-10-06 14:56:52 +02:00
kselftest_harness.h selftests/harness: Actually report SKIP for signal tests 2023-09-13 09:42:27 +02:00
kselftest_install.sh
kselftest_module.h
kselftest.h
lib.mk selftests: Keep symlinks, when possible 2023-09-19 12:28:08 +02:00
Makefile
run_kselftest.sh