Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: reuseport_addr_any: silence clang warning

Clang does not recognize that calls to error() terminate execution
and complains about uninitialized variable use that happens after calls
to error(). This noop patchset fixes this.

Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Peter Oskolkov and committed by
David S. Miller
fa232332 a02e8964

+10
+10
tools/testing/selftests/net/reuseport_addr_any.c
··· 60 60 break; 61 61 default: 62 62 error(1, 0, "Unsupported family %d", family); 63 + /* clang does not recognize error() above as terminating 64 + * the program, so it complains that saddr, sz are 65 + * not initialized when this code path is taken. Silence it. 66 + */ 67 + return; 63 68 } 64 69 65 70 for (i = 0; i < count; ++i) { ··· 133 128 break; 134 129 default: 135 130 error(1, 0, "Unsupported family %d", family); 131 + /* clang does not recognize error() above as terminating 132 + * the program, so it complains that saddr, daddr, sz are 133 + * not initialized when this code path is taken. Silence it. 134 + */ 135 + return -1; 136 136 } 137 137 138 138 fd = socket(family, proto, 0);