Skip to content

Commit af9ad82

Browse files
svens-s390Vasily Gorbik
authored andcommitted
s390/entry: use assignment to read intcode / asm to copy gprs
arch/s390/kernel/syscall.c: In function __do_syscall: arch/s390/kernel/syscall.c:147:9: warning: memcpy reading 64 bytes from a region of size 0 [-Wstringop-overread] 147 | memcpy(&regs->gprs[8], S390_lowcore.save_area_sync, 8 * sizeof(unsigned long)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/s390/kernel/syscall.c:148:9: warning: memcpy reading 4 bytes from a region of size 0 [-Wstringop-overread] 148 | memcpy(&regs->int_code, &S390_lowcore.svc_ilc, sizeof(regs->int_code)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix this by moving the gprs restore from C to assembly, and use a assignment for int_code instead of memcpy. Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent d460bb6 commit af9ad82

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

arch/s390/include/asm/lowcore.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ struct lowcore {
2424
__u32 ext_params; /* 0x0080 */
2525
__u16 ext_cpu_addr; /* 0x0084 */
2626
__u16 ext_int_code; /* 0x0086 */
27-
__u16 svc_ilc; /* 0x0088 */
28-
__u16 svc_code; /* 0x008a */
27+
__u32 svc_int_code; /* 0x0088 */
2928
__u16 pgm_ilc; /* 0x008c */
3029
__u16 pgm_code; /* 0x008e */
3130
__u32 data_exc_code; /* 0x0090 */

arch/s390/kernel/asm-offsets.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ int main(void)
5858
OFFSET(__LC_EXT_PARAMS, lowcore, ext_params);
5959
OFFSET(__LC_EXT_CPU_ADDR, lowcore, ext_cpu_addr);
6060
OFFSET(__LC_EXT_INT_CODE, lowcore, ext_int_code);
61-
OFFSET(__LC_SVC_ILC, lowcore, svc_ilc);
62-
OFFSET(__LC_SVC_INT_CODE, lowcore, svc_code);
6361
OFFSET(__LC_PGM_ILC, lowcore, pgm_ilc);
6462
OFFSET(__LC_PGM_INT_CODE, lowcore, pgm_code);
6563
OFFSET(__LC_DATA_EXC_CODE, lowcore, data_exc_code);

arch/s390/kernel/entry.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ ENTRY(system_call)
276276
xgr %r10,%r10
277277
xgr %r11,%r11
278278
la %r2,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs
279+
mvc __PT_R8(64,%r2),__LC_SAVE_AREA_SYNC
279280
lgr %r3,%r14
280281
brasl %r14,__do_syscall
281282
lctlg %c1,%c1,__LC_USER_ASCE

arch/s390/kernel/syscall.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ void noinstr __do_syscall(struct pt_regs *regs, int per_trap)
144144
{
145145
add_random_kstack_offset();
146146
enter_from_user_mode(regs);
147-
148-
memcpy(&regs->gprs[8], S390_lowcore.save_area_sync, 8 * sizeof(unsigned long));
149-
memcpy(&regs->int_code, &S390_lowcore.svc_ilc, sizeof(regs->int_code));
150147
regs->psw = S390_lowcore.svc_old_psw;
151-
148+
regs->int_code = S390_lowcore.svc_int_code;
152149
update_timer_sys();
153150

154151
local_irq_enable();

0 commit comments

Comments
 (0)