From ceeede8d84141e6e38eb9488f781683e96e1c971 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Wed, 5 May 2021 22:01:15 +0200 Subject: [PATCH] s390/cio: add union/struct to access tpi_info gcc-11 warns: In file included from include/trace/define_trace.h:103, from drivers/s390/cio/trace.h:403, from drivers/s390/cio/trace.c:13: drivers/s390/cio/./trace.h: In function perf_trace_s390_cio_tpi: drivers/s390/cio/./trace.h:172:25: warning: memcpy reading 16 bytes from a region of size 0 [-Wstringop-overread] 172 | memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 173 | sizeof(struct tpi_info)); | ~~~~~~~~~~~~~~~~~~~~~~~~ include/trace/perf.h:66:11: note: in definition of macro DECLARE_EVENT_CLASS 66 | { assign; } \ | ^~~~~~ include/trace/trace_events.h:79:30: note: in expansion of macro PARAMS 79 | PARAMS(assign), \ | ^~~~~~ drivers/s390/cio/./trace.h:152:1: note: in expansion of macro TRACE_EVENT 152 | TRACE_EVENT(s390_cio_tpi, | ^~~~~~~~~~~ drivers/s390/cio/./trace.h:165:9: note: in expansion of macro TP_fast_assign 165 | TP_fast_assign( | ^~~~~~~~~~~~~~ Fix this by adding a struct for the tpi data to struct lowcore. Signed-off-by: Sven Schnelle Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- arch/s390/include/asm/lowcore.h | 32 +++++++++++++++++++++++++------- drivers/s390/cio/cio.h | 12 ------------ drivers/s390/cio/trace.h | 3 +-- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h index 8f58c28277730..8a9fc0226ed34 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h @@ -13,10 +13,23 @@ #include #include #include +#include #define LC_ORDER 1 #define LC_PAGES 2 +/* I/O-Interruption Code as stored by TEST PENDING INTERRUPTION (TPI). */ +struct tpi_info { + struct subchannel_id schid; + u32 intparm; + u32 adapter_IO:1; + u32 directed_irq:1; + u32 isc:3; + u32 :27; + u32 type:3; + u32 :12; +} __packed __aligned(4); + struct lowcore { __u8 pad_0x0000[0x0014-0x0000]; /* 0x0000 */ __u32 ipl_parmblock_ptr; /* 0x0014 */ @@ -46,14 +59,19 @@ struct lowcore { __u64 monitor_code; /* 0x00b0 */ union { struct { - __u16 subchannel_id; /* 0x00b8 */ - __u16 subchannel_nr; /* 0x00ba */ + union { + struct { + __u16 subchannel_id; /* 0x00b8 */ + __u16 subchannel_nr; /* 0x00ba */ + } __packed; + __u32 subchannel; /* 0x00b8 */ + } __packed; + __u32 io_int_parm; /* 0x00bc */ + __u32 io_int_word; /* 0x00c0 */ + __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */ } __packed; - __u32 subchannel; - } __packed; - __u32 io_int_parm; /* 0x00bc */ - __u32 io_int_word; /* 0x00c0 */ - __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */ + struct tpi_info tpi_info; /* 0x00b8 */ + } __packed __aligned(4); __u32 stfl_fac_list; /* 0x00c8 */ __u8 pad_0x00cc[0x00e8-0x00cc]; /* 0x00cc */ __u64 mcck_interruption_code; /* 0x00e8 */ diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h index dcdaba689b20c..84d1907ad94a2 100644 --- a/drivers/s390/cio/cio.h +++ b/drivers/s390/cio/cio.h @@ -46,18 +46,6 @@ struct pmcw { /* ... in an operand exception. */ } __attribute__ ((packed)); -/* I/O-Interruption Code as stored by TEST PENDING INTERRUPTION (TPI). */ -struct tpi_info { - struct subchannel_id schid; - u32 intparm; - u32 adapter_IO:1; - u32 directed_irq:1; - u32 isc:3; - u32 :27; - u32 type:3; - u32 :12; -} __packed __aligned(4); - /* Target SCHIB configuration. */ struct schib_config { u64 mba; diff --git a/drivers/s390/cio/trace.h b/drivers/s390/cio/trace.h index 4803139bce149..6fc2029bd7284 100644 --- a/drivers/s390/cio/trace.h +++ b/drivers/s390/cio/trace.h @@ -169,8 +169,7 @@ TRACE_EVENT(s390_cio_tpi, else if (addr) __entry->tpi_info = *addr; else { - memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id, - sizeof(struct tpi_info)); + __entry->tpi_info = S390_lowcore.tpi_info; } __entry->cssid = __entry->tpi_info.schid.cssid; __entry->ssid = __entry->tpi_info.schid.ssid; -- 2.51.0