__clear_user(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ __clear_user(9) ✨

okay so this page is from the Kernel API Manual, and it's giving "small function, big responsibility" energy. Let's go πŸ’…


🌸 NAME 🌸

  • __clear_user β€” Zero a block of memory in user space, with less checking.

πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned long __clear_user (void __user *to , unsigned long n );

πŸŽ€ ARGUMENTS πŸŽ€

  • to β€” Destination address, in user space.
  • n β€” Number of bytes to zero.

πŸ’– DESCRIPTION πŸ’–

Zero a block of memory in user space. That's the whole vibe: you point at a user-space block, you say how many bytes, and it clears them.

bestie, read this part twice: the caller must check the specified block with access_ok before calling this function. That's the "less checking" part in the name β€” do not skip your access_ok check, fr fr. 🫢

πŸ”₯ RETURN πŸ”₯

It returns the number of bytes that could not be cleared. On success, this will be zero. So if you get 0, slay; if not, that's the count of bytes that didn't get cleared. πŸ’€

🌈 SEE ALSO 🌈


okay bye bestie β€” this one's from ./arch/x86/lib, dated October 2026, and it's the __clear_user(9) page πŸ’–βœ¨

πŸ“¦ where this page comes from