mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
selftests: mptcp: Mark xerror and die_perror __noreturn
Compiler reports potential uses of uninitialized variables in
mptcp_connect.c when xerror() is called from failure paths.
mptcp_connect.c:1262:11: warning: variable 'raw_addr' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
xerror() terminates execution by calling exit(), but it is not visible
to the compiler & assumes control flow may continue past the call.
Annotate xerror() with __noreturn so the compiler can correctly reason
about control flow and avoid false-positive uninitialized variable
warnings.
Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
Link: https://patch.msgid.link/20260101172840.90186-1-ankitkhushwaha.linux@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
f5e9ba9599
commit
2fa98059fd
|
|
@ -3,6 +3,7 @@
|
|||
top_srcdir = ../../../../..
|
||||
|
||||
CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
|
||||
CFLAGS += -I$(top_srcdir)/tools/include
|
||||
|
||||
TEST_PROGS := \
|
||||
diag.sh \
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <linux/tcp.h>
|
||||
#include <linux/time_types.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
extern int optind;
|
||||
|
||||
|
|
@ -140,7 +141,7 @@ static void die_usage(void)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
static void xerror(const char *fmt, ...)
|
||||
static void __noreturn xerror(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <linux/rtnetlink.h>
|
||||
#include <linux/inet_diag.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/tcp.h>
|
||||
|
|
@ -87,7 +88,7 @@ enum {
|
|||
|
||||
#define rta_getattr(type, value) (*(type *)RTA_DATA(value))
|
||||
|
||||
static void die_perror(const char *msg)
|
||||
static void __noreturn die_perror(const char *msg)
|
||||
{
|
||||
perror(msg);
|
||||
exit(1);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#ifndef IPPROTO_MPTCP
|
||||
#define IPPROTO_MPTCP 262
|
||||
|
|
@ -40,7 +41,7 @@ static int pf = AF_INET;
|
|||
static int proto_tx = IPPROTO_MPTCP;
|
||||
static int proto_rx = IPPROTO_MPTCP;
|
||||
|
||||
static void die_perror(const char *msg)
|
||||
static void __noreturn die_perror(const char *msg)
|
||||
{
|
||||
perror(msg);
|
||||
exit(1);
|
||||
|
|
@ -52,7 +53,7 @@ static void die_usage(int r)
|
|||
exit(r);
|
||||
}
|
||||
|
||||
static void xerror(const char *fmt, ...)
|
||||
static void __noreturn xerror(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <netinet/in.h>
|
||||
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
static int pf = AF_INET;
|
||||
|
||||
|
|
@ -127,7 +128,7 @@ struct so_state {
|
|||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
static void die_perror(const char *msg)
|
||||
static void __noreturn die_perror(const char *msg)
|
||||
{
|
||||
perror(msg);
|
||||
exit(1);
|
||||
|
|
@ -139,7 +140,7 @@ static void die_usage(int r)
|
|||
exit(r);
|
||||
}
|
||||
|
||||
static void xerror(const char *fmt, ...)
|
||||
static void __noreturn xerror(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user