Skip to content

Commit db52739

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/uaccess: add default cases for __put_user_fn()/__get_user_fn()
Add default cases for __put_user_fn()/__get_user_fn(). This doesn't fix anything since the functions are only called with sane values. However we get rid of smatch warnings: ./arch/s390/include/asm/uaccess.h:143 __get_user_fn() error: uninitialized symbol 'rc'. Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 4366dd7 commit db52739

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

arch/s390/include/asm/uaccess.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n);
6060
#define INLINE_COPY_TO_USER
6161
#endif
6262

63+
int __put_user_bad(void) __attribute__((noreturn));
64+
int __get_user_bad(void) __attribute__((noreturn));
65+
6366
#ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
6467

6568
#define __put_get_user_asm(to, from, size, spec) \
@@ -109,6 +112,9 @@ static __always_inline int __put_user_fn(void *x, void __user *ptr, unsigned lon
109112
(unsigned long *)x,
110113
size, spec);
111114
break;
115+
default:
116+
__put_user_bad();
117+
break;
112118
}
113119
return rc;
114120
}
@@ -139,6 +145,9 @@ static __always_inline int __get_user_fn(void *x, const void __user *ptr, unsign
139145
(unsigned long __user *)ptr,
140146
size, spec);
141147
break;
148+
default:
149+
__get_user_bad();
150+
break;
142151
}
143152
return rc;
144153
}
@@ -190,8 +199,6 @@ static inline int __get_user_fn(void *x, const void __user *ptr, unsigned long s
190199
})
191200

192201

193-
int __put_user_bad(void) __attribute__((noreturn));
194-
195202
#define __get_user(x, ptr) \
196203
({ \
197204
int __gu_err = -EFAULT; \
@@ -238,8 +245,6 @@ int __put_user_bad(void) __attribute__((noreturn));
238245
__get_user(x, ptr); \
239246
})
240247

241-
int __get_user_bad(void) __attribute__((noreturn));
242-
243248
unsigned long __must_check
244249
raw_copy_in_user(void __user *to, const void __user *from, unsigned long n);
245250

0 commit comments

Comments
 (0)