]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/uaccess: Remove __chk_user_ptr() in __get/put_user
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Wed, 10 Mar 2021 17:46:48 +0000 (17:46 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 3 Apr 2021 10:21:59 +0000 (21:21 +1100)
commit97d0195971c2c0147d0986babf947e2b3d123ec4
treeed53d5048cefa0321b16dd8b1cfb12d9fa480344
parentae61c4c9f91b214d127425a0e4d2eae7aef5db8a
powerpc/uaccess: Remove __chk_user_ptr() in __get/put_user

Commit fcf7299adc0f ("powerpc/uaccess: Evaluate macro arguments once,
before user access is allowed") changed the __chk_user_ptr()
argument from the passed ptr pointer to the locally
declared __gu_addr. But __gu_addr is locally defined as __user
so the check is pointless.

During kernel build __chk_user_ptr() voids and is only evaluated
during sparse checks so it should have been armless to leave the
original pointer check there.

Nevertheless, this check is indeed redundant with the assignment
above which casts the ptr pointer to the local __user __gu_addr.
In case of mismatch, sparse will detect it there, so the
__check_user_ptr() is not needed anywhere else than in access_ok().

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/69f17d75046733b891ab2e668dbf464787cdf598.1615398265.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/uaccess.h