check_zeroed_user(9)
π check_zeroed_user(9) β like, the Kernel API Manual page, bestie β¨
Okay so this is check_zeroed_user(9) from the Kernel API Manual, and it is literally the most useful little function you didn't know you needed. Grab a snack, we're checking bytes π
πΈ NAME
check_zeroed_user β check if a userspace buffer only contains zero bytes. That's it. That's the whole vibe check π«Ά
β¨ SYNOPSIS
int check_zeroed_user (const void __user *from , size_t size );
π ARGUMENTS
fromβ Source address, in userspace. Yes bestie, userspace β do not come in here with a kernel pointer, that's not the assignment πsizeβ Size of buffer. How much of it are we sniffing for zeros, mmkay?
π DESCRIPTION
So the way this works is: it's effectively shorthand for "memchr_inv(from, 0, size) == NULL" β but for userspace addresses. And it's more efficient, because honestly? We don't care where the first non-zero byte is. We just need to know if one exists. No cap. π
π₯ RETURN
0β There were non-zero bytes present in the buffer. Something's in there, icon.1β The buffer was full of zero bytes. All zeros, no notes, slay β-EFAULTβ access to userspace failed π (it happens to the best of us)
π¦ SEE ALSO
Kernel file ./lib/usercopy.c β go read it, iykyk π
ngl this one's short but it ate. Zero bytes? Checked. Main character energy? Immaculate. π
Source directory: ./lib Β· Version date: October 2026 Β· check_zeroed_user(9) β mwah, thanks for reading bestie, ily, go forth and check those zeros π§π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms