memdup_user_nul(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– memdup_user_nul(9) πŸ’–

ok so bestie, you found it β€” the page for memdup_user_nul, straight out of the Kernel API Manual (section 9, kernel-space edition, we're fancy today πŸŽ€). This one's a little baby function that copies some bytes out of user space and makes sure the result is NUL-terminated. Ngl it's short, but it eats.


✨ NAME ✨

memdup_user_nul β€” duplicate a memory region from user space and NUL-terminate it 🫢


🌸 SYNOPSIS 🌸

void * memdup_user_nul (const void __user *src , size_t len );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • src β€” the source address, and it lives in user space (yes, the __user is doing the heavy lifting here πŸ‘€).
  • len β€” how many bytes we're copying, periodt.

⭐ RETURN ⭐

On failure you get an ERR_PTR back. That's the whole vibe the page gives us β€” it's literally the only thing documented under RETURN 😭 so like, check the return value properly, IS_ERR() girlies know what's up. (The success return is not spelled out here, so I'm not gonna make it up for you πŸ’….)


πŸ”₯ SEE ALSO πŸ”₯

lowkey that's a whole friend group of memory-copying functions and I love that for them 🌈

and that's the whole page, bestie β€” no cap, it's a short one πŸ“

this iconic little writeup lives under ./mm in the Kernel API Manual, dated October 2026 β€” mwah, see u in the next man page πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from