size_add(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so welcome to size_add(9) from the Kernel API Manual β€” the saturation queen of size_t addition πŸ’…βœ¨. This page is literally about calculating size_t addition with saturation at SIZE_MAX. bestie, it’s giving β€œmath but make it kernel-safe.” 🫢


🌸 SYNOPSIS 🌸

the whole flex is:

size_t size_add (size_t addend1 , size_t addend2 );

πŸŽ€ ARGUMENTS πŸŽ€

  • addend1 β€” the first addend. literally the first number going in. πŸ“
  • addend2 β€” the second addend. the other one. πŸ“

✨ RETURN ✨

It calculates addend1 + addend2, with both promoted to size_t, and any overflow causes the return value to be SIZE_MAX. slay, no cap. πŸ”₯

⚠️ Important caveat: the lvalue must be size_t to avoid implicit type conversion. do not get cute with a smaller type, okay? that’s the rule, periodt. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

bestie, the whole overflow.h friend group is right here in the kernel file ./include/linux/overflow.h β€” go say hi:


sign-off realness: this page is chillin’ in source ./include/linux, version Kernel API Manual, dated October 2026, and it’s serving size_add(9). bye bestie πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from