linux-stable/tools
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
..
accounting
arch parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes 2023-12-08 08:51:15 +01:00
bootconfig bootconfig: Fix testcase to increase max node 2023-03-30 12:49:07 +02:00
bpf bpftool: Use a local bpf_perf_event_value to fix accessing its fields 2023-09-13 09:42:30 +02:00
build perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available 2022-10-25 17:40:48 -03:00
certs
cgroup
counter
debugging
edid
firewire
firmware
gpio tools: gpio: fix debounce_period_us output of lsgpio 2023-06-21 16:00:52 +02:00
hv vmbus_testing: fix wrong python syntax for integer value comparison 2023-09-13 09:42:23 +02:00
iio tools: iio: iio_generic_buffer ensure alignment 2023-11-20 11:52:10 +01:00
include maple_tree: add GFP_KERNEL to allocations in mas_expected_entries() 2023-11-02 09:35:24 +01:00
io_uring
kvm/kvm_stat tools/kvm_stat: update exit reasons for vmx/svm/aarch64/userspace 2022-11-09 12:26:52 -05:00
laptop
leds
lib libbpf: Free btf_vmlinux when closing bpf_object 2023-09-23 11:11:03 +02:00
memory-model
objtool objtool: Propagate early errors 2023-11-20 11:51:50 +01:00
pci
pcmcia
perf perf intel-pt: Fix async branch flags 2023-11-28 17:07:07 +00:00
power tools/power/turbostat: Enable the C-state Pre-wake printing 2023-11-28 17:07:06 +00:00
rcu
scripts
spi
testing selftests/net: mptcp: fix uninitialized variable warnings 2023-12-08 08:51:17 +01:00
thermal
time
tracing tools/tracing/rtla: osnoise_hist: use total duration for average calculation 2023-03-10 09:33:26 +01:00
usb
verification rv/dot2c: Make automaton definition static 2022-10-20 16:02:45 -04:00
virtio tools/virtio: fix the vringh test for virtio ring changes 2023-02-22 12:59:42 +01:00
vm tools/mm/page_owner_sort.c: fix TGID output when cull=tg is used 2023-04-26 14:28:39 +02:00
wmi
Makefile