manu markj hselasky avg
- Group Reviewers
linuxkpi Linux Emulation Src Committers
- rG18057f471dc4: linuxkpi: Add strndup_user
rGa11195df34f7: linuxkpi: Add strndup_user
There's no need for this check, memdup_user() will handle it. A user-supplied pointer can never be trusted, so there's no real reason to check for NULL specifically (it could be 0x1, or any other invalid value).
Removed NULL pointer error checking thanks to @markj. General user pointers are safely checked in memdup_user().
I think "n" excludes the NUL character.
Why can't you simply do:
return (memdup_user_nul(ustr, n));
Used memdup_user_nul() instead of memdup_user() to duplicate memory from userspace. Relevant documentation can be found here: