Skip to content

Commit 5e680e2

Browse files
hcahcaAlexander Gordeev
authored andcommitted
s390/uaccess: Move put_user() / __put_user() close to put_user() asm code
Keep put_user() and get_user() code separated. Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent c7474da commit 5e680e2

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

arch/s390/include/asm/uaccess.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,36 @@ static __always_inline int __put_user_fn(void *x, void __user *ptr, unsigned lon
160160
return rc;
161161
}
162162

163+
/*
164+
* These are the main single-value transfer routines. They automatically
165+
* use the right size if we just have the right pointer type.
166+
*/
167+
#define __put_user(x, ptr) \
168+
({ \
169+
__typeof__(*(ptr)) __x = (x); \
170+
int __pu_err = -EFAULT; \
171+
\
172+
__chk_user_ptr(ptr); \
173+
switch (sizeof(*(ptr))) { \
174+
case 1: \
175+
case 2: \
176+
case 4: \
177+
case 8: \
178+
__pu_err = __put_user_fn(&__x, ptr, sizeof(*(ptr))); \
179+
break; \
180+
default: \
181+
__put_user_bad(); \
182+
break; \
183+
} \
184+
__builtin_expect(__pu_err, 0); \
185+
})
186+
187+
#define put_user(x, ptr) \
188+
({ \
189+
might_fault(); \
190+
__put_user(x, ptr); \
191+
})
192+
163193
int __noreturn __get_user_bad(void);
164194

165195
#define DEFINE_GET_USER(type) \
@@ -237,36 +267,6 @@ static __always_inline int __get_user_fn(void *x, const void __user *ptr, unsign
237267
return rc;
238268
}
239269

240-
/*
241-
* These are the main single-value transfer routines. They automatically
242-
* use the right size if we just have the right pointer type.
243-
*/
244-
#define __put_user(x, ptr) \
245-
({ \
246-
__typeof__(*(ptr)) __x = (x); \
247-
int __pu_err = -EFAULT; \
248-
\
249-
__chk_user_ptr(ptr); \
250-
switch (sizeof(*(ptr))) { \
251-
case 1: \
252-
case 2: \
253-
case 4: \
254-
case 8: \
255-
__pu_err = __put_user_fn(&__x, ptr, sizeof(*(ptr))); \
256-
break; \
257-
default: \
258-
__put_user_bad(); \
259-
break; \
260-
} \
261-
__builtin_expect(__pu_err, 0); \
262-
})
263-
264-
#define put_user(x, ptr) \
265-
({ \
266-
might_fault(); \
267-
__put_user(x, ptr); \
268-
})
269-
270270
#define __get_user(x, ptr) \
271271
({ \
272272
int __gu_err = -EFAULT; \

0 commit comments

Comments
 (0)