path: root/kernel/compat.c
diff options
authorH. Peter Anvin <>2014-02-02 17:57:28 -0800
committerH. Peter Anvin <>2014-02-02 18:00:29 -0800
commitdce44e03b0a3448ad11ac6c6e0cbe299e0400791 (patch)
treea5ba20404d5159a7cb00d3b8e448ec17f50322f3 /kernel/compat.c
parent81993e81a994504f4c8b97d3410c9a052cdbcc9d (diff)
compat: Fix sparse address space warnings
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 <> Cc: Toyo Abe <> Link:
Diffstat (limited to 'kernel/compat.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/compat.c b/kernel/compat.c
index 3afc524a57ad..7076b57fa52e 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -451,7 +451,7 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
mm_segment_t old_fs = get_fs();
- ret = sys_old_getrlimit(resource, &r);
+ ret = sys_old_getrlimit(resource, (struct rlimit __user *)&r);
if (!ret) {
@@ -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();