Skip to content

Commit 291fdb0

Browse files
committed
ipc/compat_sys_msgrcv: change msgtyp type from long to compat_long_t
Change the type of compat_sys_msgrcv's msgtyp parameter from long to compat_long_t, since compat user space passes only a 32 bit signed value. Let the compat wrapper do proper sign extension to 64 bit of this parameter. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
1 parent c2e7c3d commit 291fdb0

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎include/linux/compat.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
321321
asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
322322
compat_ssize_t msgsz, int msgflg);
323323
asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,
324-
compat_ssize_t msgsz, long msgtyp, int msgflg);
324+
compat_ssize_t msgsz, compat_long_t msgtyp, int msgflg);
325325
long compat_sys_msgctl(int first, int second, void __user *uptr);
326326
long compat_sys_shmctl(int first, int second, void __user *uptr);
327327
long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,

‎ipc/compat.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@ COMPAT_SYSCALL_DEFINE4(msgsnd, int, msqid, compat_uptr_t, msgp,
430430
}
431431

432432
COMPAT_SYSCALL_DEFINE5(msgrcv, int, msqid, compat_uptr_t, msgp,
433-
compat_ssize_t, msgsz, long, msgtyp, int, msgflg)
433+
compat_ssize_t, msgsz, compat_long_t, msgtyp, int, msgflg)
434434
{
435-
return do_msgrcv(msqid, compat_ptr(msgp), (ssize_t)msgsz, msgtyp,
435+
return do_msgrcv(msqid, compat_ptr(msgp), (ssize_t)msgsz, (long)msgtyp,
436436
msgflg, compat_do_msg_fill);
437437
}
438438

0 commit comments

Comments
 (0)