Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/uaccess: Move copy_mc_xxx() functions down

copy_mc_xxx() functions are in the middle of raw_copy functions.

For clarity, move them out of the raw_copy functions block.

They are using access_ok, so they need to be after the general
functions in order to eventually allow the inclusion of
asm-generic/uaccess.h in some future.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/2cdecb6e5a2fcee6c158d18dd254b71ec0e0da4d.1615398498.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
4b8cda58 7472199a

+26 -26
+26 -26
arch/powerpc/include/asm/uaccess.h
··· 351 351 extern unsigned long __copy_tofrom_user(void __user *to, 352 352 const void __user *from, unsigned long size); 353 353 354 - #ifdef CONFIG_ARCH_HAS_COPY_MC 355 - unsigned long __must_check 356 - copy_mc_generic(void *to, const void *from, unsigned long size); 357 - 358 - static inline unsigned long __must_check 359 - copy_mc_to_kernel(void *to, const void *from, unsigned long size) 360 - { 361 - return copy_mc_generic(to, from, size); 362 - } 363 - #define copy_mc_to_kernel copy_mc_to_kernel 364 - 365 - static inline unsigned long __must_check 366 - copy_mc_to_user(void __user *to, const void *from, unsigned long n) 367 - { 368 - if (likely(check_copy_size(from, n, true))) { 369 - if (access_ok(to, n)) { 370 - allow_write_to_user(to, n); 371 - n = copy_mc_generic((void *)to, from, n); 372 - prevent_write_to_user(to, n); 373 - } 374 - } 375 - 376 - return n; 377 - } 378 - #endif 379 - 380 354 #ifdef __powerpc64__ 381 355 static inline unsigned long 382 356 raw_copy_in_user(void __user *to, const void __user *from, unsigned long n) ··· 406 432 407 433 extern long strncpy_from_user(char *dst, const char __user *src, long count); 408 434 extern __must_check long strnlen_user(const char __user *str, long n); 435 + 436 + #ifdef CONFIG_ARCH_HAS_COPY_MC 437 + unsigned long __must_check 438 + copy_mc_generic(void *to, const void *from, unsigned long size); 439 + 440 + static inline unsigned long __must_check 441 + copy_mc_to_kernel(void *to, const void *from, unsigned long size) 442 + { 443 + return copy_mc_generic(to, from, size); 444 + } 445 + #define copy_mc_to_kernel copy_mc_to_kernel 446 + 447 + static inline unsigned long __must_check 448 + copy_mc_to_user(void __user *to, const void *from, unsigned long n) 449 + { 450 + if (likely(check_copy_size(from, n, true))) { 451 + if (access_ok(to, n)) { 452 + allow_write_to_user(to, n); 453 + n = copy_mc_generic((void *)to, from, n); 454 + prevent_write_to_user(to, n); 455 + } 456 + } 457 + 458 + return n; 459 + } 460 + #endif 409 461 410 462 extern long __copy_from_user_flushcache(void *dst, const void __user *src, 411 463 unsigned size);