diff options
Diffstat (limited to 'ipc/compat.c')
-rw-r--r-- | ipc/compat.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ipc/compat.c b/ipc/compat.c index a6df704f521e..ad9518eb26e0 100644 --- a/ipc/compat.c +++ b/ipc/compat.c | |||
@@ -118,7 +118,7 @@ extern int sem_ctls[]; | |||
118 | 118 | ||
119 | static inline int compat_ipc_parse_version(int *cmd) | 119 | static inline int compat_ipc_parse_version(int *cmd) |
120 | { | 120 | { |
121 | #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC | 121 | #ifdef CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION |
122 | int version = *cmd & IPC_64; | 122 | int version = *cmd & IPC_64; |
123 | 123 | ||
124 | /* this is tricky: architectures that have support for the old | 124 | /* this is tricky: architectures that have support for the old |
@@ -373,21 +373,21 @@ long compat_sys_semctl(int semid, int semnum, int cmd, int arg) | |||
373 | } | 373 | } |
374 | 374 | ||
375 | long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, | 375 | long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, |
376 | size_t msgsz, int msgflg) | 376 | compat_ssize_t msgsz, int msgflg) |
377 | { | 377 | { |
378 | compat_long_t mtype; | 378 | compat_long_t mtype; |
379 | 379 | ||
380 | if (get_user(mtype, &msgp->mtype)) | 380 | if (get_user(mtype, &msgp->mtype)) |
381 | return -EFAULT; | 381 | return -EFAULT; |
382 | return do_msgsnd(msqid, mtype, msgp->mtext, msgsz, msgflg); | 382 | return do_msgsnd(msqid, mtype, msgp->mtext, (ssize_t)msgsz, msgflg); |
383 | } | 383 | } |
384 | 384 | ||
385 | long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, | 385 | long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, |
386 | size_t msgsz, long msgtyp, int msgflg) | 386 | compat_ssize_t msgsz, long msgtyp, int msgflg) |
387 | { | 387 | { |
388 | long err, mtype; | 388 | long err, mtype; |
389 | 389 | ||
390 | err = do_msgrcv(msqid, &mtype, msgp->mtext, msgsz, msgtyp, msgflg); | 390 | err = do_msgrcv(msqid, &mtype, msgp->mtext, (ssize_t)msgsz, msgtyp, msgflg); |
391 | if (err < 0) | 391 | if (err < 0) |
392 | goto out; | 392 | goto out; |
393 | 393 | ||
@@ -514,6 +514,10 @@ long compat_sys_msgctl(int first, int second, void __user *uptr) | |||
514 | return err; | 514 | return err; |
515 | } | 515 | } |
516 | 516 | ||
517 | #ifndef COMPAT_SHMLBA | ||
518 | #define COMPAT_SHMLBA SHMLBA | ||
519 | #endif | ||
520 | |||
517 | #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC | 521 | #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC |
518 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, | 522 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, |
519 | void __user *uptr) | 523 | void __user *uptr) |
@@ -524,7 +528,7 @@ long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, | |||
524 | 528 | ||
525 | if (version == 1) | 529 | if (version == 1) |
526 | return -EINVAL; | 530 | return -EINVAL; |
527 | err = do_shmat(first, uptr, second, &raddr); | 531 | err = do_shmat(first, uptr, second, &raddr, COMPAT_SHMLBA); |
528 | if (err < 0) | 532 | if (err < 0) |
529 | return err; | 533 | return err; |
530 | uaddr = compat_ptr(third); | 534 | uaddr = compat_ptr(third); |
@@ -536,7 +540,7 @@ long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg) | |||
536 | unsigned long ret; | 540 | unsigned long ret; |
537 | long err; | 541 | long err; |
538 | 542 | ||
539 | err = do_shmat(shmid, compat_ptr(shmaddr), shmflg, &ret); | 543 | err = do_shmat(shmid, compat_ptr(shmaddr), shmflg, &ret, COMPAT_SHMLBA); |
540 | if (err) | 544 | if (err) |
541 | return err; | 545 | return err; |
542 | force_successful_syscall_return(); | 546 | force_successful_syscall_return(); |