Skip to content

Commit

Permalink
compat: Fix sparse address space warnings
Browse files Browse the repository at this point in the history
In compat_sys_old_getrlimit() we pass a kernel pointer to
sys_old_getrlimit() inside a set_fs() bracket.  This is okay, so we
can safely cast the affected pointer to __user.

In compat_clock_nanosleep_restart(), the variable "rmtp" holds a user
pointer.  Annotate it as such.

Both of these warnings are ancient, but were reported by Fengguang
Wu's test system due to other changes.

Signed-off-by: H. Peter Anvin <[email protected]>
Cc: Toyo Abe <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
  • Loading branch information
H. Peter Anvin committed Feb 3, 2014
1 parent 81993e8 commit dce44e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
mm_segment_t old_fs = get_fs();

set_fs(KERNEL_DS);
ret = sys_old_getrlimit(resource, &r);
ret = sys_old_getrlimit(resource, (struct rlimit __user *)&r);
set_fs(old_fs);

if (!ret) {
Expand Down Expand Up @@ -799,7 +799,7 @@ static long compat_clock_nanosleep_restart(struct restart_block *restart)
long err;
mm_segment_t oldfs;
struct timespec tu;
struct compat_timespec *rmtp = restart->nanosleep.compat_rmtp;
struct compat_timespec __user *rmtp = restart->nanosleep.compat_rmtp;

restart->nanosleep.rmtp = (struct timespec __user *) &tu;
oldfs = get_fs();
Expand Down

0 comments on commit dce44e0

Please sign in to comment.