diff options
-rw-r--r-- | kernel/compat.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index 3bae3742c2aa..b78328af19ad 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -247,8 +247,8 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource, | |||
247 | int ret; | 247 | int ret; |
248 | mm_segment_t old_fs = get_fs (); | 248 | mm_segment_t old_fs = get_fs (); |
249 | 249 | ||
250 | if (resource >= RLIM_NLIMITS) | 250 | if (resource >= RLIM_NLIMITS) |
251 | return -EINVAL; | 251 | return -EINVAL; |
252 | 252 | ||
253 | if (!access_ok(VERIFY_READ, rlim, sizeof(*rlim)) || | 253 | if (!access_ok(VERIFY_READ, rlim, sizeof(*rlim)) || |
254 | __get_user(r.rlim_cur, &rlim->rlim_cur) || | 254 | __get_user(r.rlim_cur, &rlim->rlim_cur) || |
@@ -477,21 +477,21 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, | |||
477 | 477 | ||
478 | int get_compat_itimerspec(struct itimerspec *dst, | 478 | int get_compat_itimerspec(struct itimerspec *dst, |
479 | const struct compat_itimerspec __user *src) | 479 | const struct compat_itimerspec __user *src) |
480 | { | 480 | { |
481 | if (get_compat_timespec(&dst->it_interval, &src->it_interval) || | 481 | if (get_compat_timespec(&dst->it_interval, &src->it_interval) || |
482 | get_compat_timespec(&dst->it_value, &src->it_value)) | 482 | get_compat_timespec(&dst->it_value, &src->it_value)) |
483 | return -EFAULT; | 483 | return -EFAULT; |
484 | return 0; | 484 | return 0; |
485 | } | 485 | } |
486 | 486 | ||
487 | int put_compat_itimerspec(struct compat_itimerspec __user *dst, | 487 | int put_compat_itimerspec(struct compat_itimerspec __user *dst, |
488 | const struct itimerspec *src) | 488 | const struct itimerspec *src) |
489 | { | 489 | { |
490 | if (put_compat_timespec(&src->it_interval, &dst->it_interval) || | 490 | if (put_compat_timespec(&src->it_interval, &dst->it_interval) || |
491 | put_compat_timespec(&src->it_value, &dst->it_value)) | 491 | put_compat_timespec(&src->it_value, &dst->it_value)) |
492 | return -EFAULT; | 492 | return -EFAULT; |
493 | return 0; | 493 | return 0; |
494 | } | 494 | } |
495 | 495 | ||
496 | long compat_sys_timer_create(clockid_t which_clock, | 496 | long compat_sys_timer_create(clockid_t which_clock, |
497 | struct compat_sigevent __user *timer_event_spec, | 497 | struct compat_sigevent __user *timer_event_spec, |
@@ -512,9 +512,9 @@ long compat_sys_timer_create(clockid_t which_clock, | |||
512 | } | 512 | } |
513 | 513 | ||
514 | long compat_sys_timer_settime(timer_t timer_id, int flags, | 514 | long compat_sys_timer_settime(timer_t timer_id, int flags, |
515 | struct compat_itimerspec __user *new, | 515 | struct compat_itimerspec __user *new, |
516 | struct compat_itimerspec __user *old) | 516 | struct compat_itimerspec __user *old) |
517 | { | 517 | { |
518 | long err; | 518 | long err; |
519 | mm_segment_t oldfs; | 519 | mm_segment_t oldfs; |
520 | struct itimerspec newts, oldts; | 520 | struct itimerspec newts, oldts; |
@@ -522,58 +522,58 @@ long compat_sys_timer_settime(timer_t timer_id, int flags, | |||
522 | if (!new) | 522 | if (!new) |
523 | return -EINVAL; | 523 | return -EINVAL; |
524 | if (get_compat_itimerspec(&newts, new)) | 524 | if (get_compat_itimerspec(&newts, new)) |
525 | return -EFAULT; | 525 | return -EFAULT; |
526 | oldfs = get_fs(); | 526 | oldfs = get_fs(); |
527 | set_fs(KERNEL_DS); | 527 | set_fs(KERNEL_DS); |
528 | err = sys_timer_settime(timer_id, flags, | 528 | err = sys_timer_settime(timer_id, flags, |
529 | (struct itimerspec __user *) &newts, | 529 | (struct itimerspec __user *) &newts, |
530 | (struct itimerspec __user *) &oldts); | 530 | (struct itimerspec __user *) &oldts); |
531 | set_fs(oldfs); | 531 | set_fs(oldfs); |
532 | if (!err && old && put_compat_itimerspec(old, &oldts)) | 532 | if (!err && old && put_compat_itimerspec(old, &oldts)) |
533 | return -EFAULT; | 533 | return -EFAULT; |
534 | return err; | 534 | return err; |
535 | } | 535 | } |
536 | 536 | ||
537 | long compat_sys_timer_gettime(timer_t timer_id, | 537 | long compat_sys_timer_gettime(timer_t timer_id, |
538 | struct compat_itimerspec __user *setting) | 538 | struct compat_itimerspec __user *setting) |
539 | { | 539 | { |
540 | long err; | 540 | long err; |
541 | mm_segment_t oldfs; | 541 | mm_segment_t oldfs; |
542 | struct itimerspec ts; | 542 | struct itimerspec ts; |
543 | 543 | ||
544 | oldfs = get_fs(); | 544 | oldfs = get_fs(); |
545 | set_fs(KERNEL_DS); | 545 | set_fs(KERNEL_DS); |
546 | err = sys_timer_gettime(timer_id, | 546 | err = sys_timer_gettime(timer_id, |
547 | (struct itimerspec __user *) &ts); | 547 | (struct itimerspec __user *) &ts); |
548 | set_fs(oldfs); | 548 | set_fs(oldfs); |
549 | if (!err && put_compat_itimerspec(setting, &ts)) | 549 | if (!err && put_compat_itimerspec(setting, &ts)) |
550 | return -EFAULT; | 550 | return -EFAULT; |
551 | return err; | 551 | return err; |
552 | } | 552 | } |
553 | 553 | ||
554 | long compat_sys_clock_settime(clockid_t which_clock, | 554 | long compat_sys_clock_settime(clockid_t which_clock, |
555 | struct compat_timespec __user *tp) | 555 | struct compat_timespec __user *tp) |
556 | { | 556 | { |
557 | long err; | 557 | long err; |
558 | mm_segment_t oldfs; | 558 | mm_segment_t oldfs; |
559 | struct timespec ts; | 559 | struct timespec ts; |
560 | 560 | ||
561 | if (get_compat_timespec(&ts, tp)) | 561 | if (get_compat_timespec(&ts, tp)) |
562 | return -EFAULT; | 562 | return -EFAULT; |
563 | oldfs = get_fs(); | 563 | oldfs = get_fs(); |
564 | set_fs(KERNEL_DS); | 564 | set_fs(KERNEL_DS); |
565 | err = sys_clock_settime(which_clock, | 565 | err = sys_clock_settime(which_clock, |
566 | (struct timespec __user *) &ts); | 566 | (struct timespec __user *) &ts); |
567 | set_fs(oldfs); | 567 | set_fs(oldfs); |
568 | return err; | 568 | return err; |
569 | } | 569 | } |
570 | 570 | ||
571 | long compat_sys_clock_gettime(clockid_t which_clock, | 571 | long compat_sys_clock_gettime(clockid_t which_clock, |
572 | struct compat_timespec __user *tp) | 572 | struct compat_timespec __user *tp) |
573 | { | 573 | { |
574 | long err; | 574 | long err; |
575 | mm_segment_t oldfs; | 575 | mm_segment_t oldfs; |
576 | struct timespec ts; | 576 | struct timespec ts; |
577 | 577 | ||
578 | oldfs = get_fs(); | 578 | oldfs = get_fs(); |
579 | set_fs(KERNEL_DS); | 579 | set_fs(KERNEL_DS); |
@@ -581,16 +581,16 @@ long compat_sys_clock_gettime(clockid_t which_clock, | |||
581 | (struct timespec __user *) &ts); | 581 | (struct timespec __user *) &ts); |
582 | set_fs(oldfs); | 582 | set_fs(oldfs); |
583 | if (!err && put_compat_timespec(&ts, tp)) | 583 | if (!err && put_compat_timespec(&ts, tp)) |
584 | return -EFAULT; | 584 | return -EFAULT; |
585 | return err; | 585 | return err; |
586 | } | 586 | } |
587 | 587 | ||
588 | long compat_sys_clock_getres(clockid_t which_clock, | 588 | long compat_sys_clock_getres(clockid_t which_clock, |
589 | struct compat_timespec __user *tp) | 589 | struct compat_timespec __user *tp) |
590 | { | 590 | { |
591 | long err; | 591 | long err; |
592 | mm_segment_t oldfs; | 592 | mm_segment_t oldfs; |
593 | struct timespec ts; | 593 | struct timespec ts; |
594 | 594 | ||
595 | oldfs = get_fs(); | 595 | oldfs = get_fs(); |
596 | set_fs(KERNEL_DS); | 596 | set_fs(KERNEL_DS); |
@@ -598,9 +598,9 @@ long compat_sys_clock_getres(clockid_t which_clock, | |||
598 | (struct timespec __user *) &ts); | 598 | (struct timespec __user *) &ts); |
599 | set_fs(oldfs); | 599 | set_fs(oldfs); |
600 | if (!err && tp && put_compat_timespec(&ts, tp)) | 600 | if (!err && tp && put_compat_timespec(&ts, tp)) |
601 | return -EFAULT; | 601 | return -EFAULT; |
602 | return err; | 602 | return err; |
603 | } | 603 | } |
604 | 604 | ||
605 | static long compat_clock_nanosleep_restart(struct restart_block *restart) | 605 | static long compat_clock_nanosleep_restart(struct restart_block *restart) |
606 | { | 606 | { |
@@ -632,10 +632,10 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, | |||
632 | { | 632 | { |
633 | long err; | 633 | long err; |
634 | mm_segment_t oldfs; | 634 | mm_segment_t oldfs; |
635 | struct timespec in, out; | 635 | struct timespec in, out; |
636 | struct restart_block *restart; | 636 | struct restart_block *restart; |
637 | 637 | ||
638 | if (get_compat_timespec(&in, rqtp)) | 638 | if (get_compat_timespec(&in, rqtp)) |
639 | return -EFAULT; | 639 | return -EFAULT; |
640 | 640 | ||
641 | oldfs = get_fs(); | 641 | oldfs = get_fs(); |
@@ -654,8 +654,8 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, | |||
654 | restart->fn = compat_clock_nanosleep_restart; | 654 | restart->fn = compat_clock_nanosleep_restart; |
655 | restart->arg1 = (unsigned long) rmtp; | 655 | restart->arg1 = (unsigned long) rmtp; |
656 | } | 656 | } |
657 | return err; | 657 | return err; |
658 | } | 658 | } |
659 | 659 | ||
660 | /* | 660 | /* |
661 | * We currently only need the following fields from the sigevent | 661 | * We currently only need the following fields from the sigevent |