Details
Details
- Reviewers
manu markj • hselasky avg - Group Reviewers
linuxkpi Linux Emulation Src Committers - Commits
- rG18057f471dc4: linuxkpi: Add strndup_user
rGa11195df34f7: linuxkpi: Add strndup_user
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
sys/compat/linuxkpi/common/include/linux/string.h | ||
---|---|---|
107 | 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). |
Comment Actions
Removed NULL pointer error checking thanks to @markj. General user pointers are safely checked in memdup_user().
sys/compat/linuxkpi/common/include/linux/string.h | ||
---|---|---|
109 | I think "n" excludes the NUL character. Why can't you simply do: return (memdup_user_nul(ustr, n)); |
Comment Actions
Used memdup_user_nul() instead of memdup_user() to duplicate memory from userspace. Relevant documentation can be found here:
https://www.kernel.org/doc/html/v5.0/core-api/kernel-api.html