Re: [PATCH rdma-next 1/4] gcov: Open-code kmemdup() to work correctly with kernel and user space pointers
From: Linus Torvalds
Date: Wed Sep 02 2020 - 14:27:37 EST
On Wed, Sep 2, 2020 at 10:46 AM Leon Romanovsky <leon@xxxxxxxxxx> wrote:
>
> Definitely my explanation is wrong, but it was my interpretation of
> "BUG: KASAN: global-out-of-bounds in kmemdup+0x43/0x70" line. I saw
> that the failure was in memcpy() inside of kmemdup(), so I changed
> from memcpy to be copy_from_user() and it solved the KASAN warning.
But the actual patch attached to that explanation *doesn't* use
copy_from_user().
So your "changed from memcpy to be copy_from_user() solved the KASAN
warning" explanation makes even less sense. Because that's not at all
what the patch does.
Linus