wrapping_assign_add(9)
π wrapping_assign_add(9) β from the Kernel API Manual, bestie
Okay so picture this: it's a kernel API manual, the vibe is immaculate, and the function is literally called wrapping_assign_add. Yes, that's the whole name. We're doing this. π«Ά
β¨ NAME β¨
wrapping_assign_add β intentionally performing a wrapping increment assignment. Like, on purpose. Deliberately. Not an accident, not a bug, intentional. The audacity is the point π
π SYNOPSIS π
wrapping_assign_add (var , offset );
That's it. That's the whole call. Two things in, magic happens β¨
πΈ ARGUMENTS πΈ
varβ the variable getting incremented. She's the main character here πoffsetβ how much you're adding. The amount. The contribution. The addend energy π
π¦ DESCRIPTION π¦
So what it does is: it increments var by offset, with wrap-around. Then it returns the resulting value of var. And because it wraps on purpose, it will not trip any wrap-around sanitizers π β which is honestly the entire flex. That's the assignment, that's the whole reason she exists.
Returns the new value of var. (Yes, they said it twice. No, I'm not gonna pretend they didn't. Lowkey iconic of them to be that thorough π)
β SEE ALSO β
Everything below lives in the kernel file ./include/linux/overflow.h, and honestly? The whole overflow friend group showed up. Periodt π
check_add_overflow(9)wrapping_add(9)check_sub_overflow(9)wrapping_sub(9)wrapping_assign_sub(9)check_mul_overflow(9)wrapping_mul(9)check_shl_overflow(9)overflows_type(9)range_overflows(9)range_overflows_t(9)range_end_overflows(9)range_end_overflows_t(9)castable_to_type(9)size_mul(9)size_add(9)size_sub(9)array_size(9)array3_size(9)flex_array_size(9)struct_size(9)struct_size_t(9)struct_offset(9)__DEFINE_FLEX(9)_DEFINE_FLEX(9)DEFINE_RAW_FLEX(9)DEFINE_FLEX(9)STACK_FLEX_ARRAY_SIZE(9)typeof_flex_counter(9)overflows_flex_counter_type(9)__set_flex_counter(9)
Go off, overflow.h. Genuinely the most stacked SEE ALSO section I've ever seen π§
π Credits time, bestie: this page comes from ./include/linux, dated October 2026, and it's wrapping_assign_add(9) all the way down. Slay, wrap around responsibly, mwah π
π¦ 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