From: Sven Schnelle Date: Wed, 5 May 2021 20:01:12 +0000 (+0200) Subject: s390/irq: add union/struct to access io interrupt data X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=74fb6232b37e2a038fbfe52d766b5db844acd4e2;p=users%2Fjedix%2Flinux-maple.git s390/irq: add union/struct to access io interrupt data arch/s390/kernel/irq.c: In function do_io_irq: arch/s390/kernel/irq.c:149:17: warning: memcpy reading 12 bytes from a region of size 0 [-Wstringop-overread] 149 | memcpy(®s->int_code, &S390_lowcore.subchannel_id, 12); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix this by adding a struct for the subchannel data to struct lowcore. Signed-off-by: Sven Schnelle Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h index d08813c7f4625..8f58c28277730 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h @@ -44,8 +44,13 @@ struct lowcore { __u8 pad_0x00a4[0x00a8-0x00a4]; /* 0x00a4 */ __u64 trans_exc_code; /* 0x00a8 */ __u64 monitor_code; /* 0x00b0 */ - __u16 subchannel_id; /* 0x00b8 */ - __u16 subchannel_nr; /* 0x00ba */ + union { + struct { + __u16 subchannel_id; /* 0x00b8 */ + __u16 subchannel_nr; /* 0x00ba */ + } __packed; + __u32 subchannel; + } __packed; __u32 io_int_parm; /* 0x00bc */ __u32 io_int_word; /* 0x00c0 */ __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */ diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c index 169258012530a..1370d37230171 100644 --- a/arch/s390/kernel/irq.c +++ b/arch/s390/kernel/irq.c @@ -146,7 +146,10 @@ void noinstr do_io_irq(struct pt_regs *regs) account_idle_time_irq(); do { - memcpy(®s->int_code, &S390_lowcore.subchannel_id, 12); + regs->int_code = S390_lowcore.subchannel; + regs->int_parm = S390_lowcore.io_int_parm; + regs->int_parm_long = (unsigned long)S390_lowcore.io_int_word << 32; + if (S390_lowcore.io_int_word & BIT(31)) do_irq_async(regs, THIN_INTERRUPT); else