wrapping_assign_sub(9)
π wrapping_assign_sub(9) β like, the Kernel API Manual, but make it make sense β¨
okay so bestie, welcome to wrapping_assign_sub(9), straight out of the Kernel API Manual. no cap, this one's a tiny little legend and you're gonna love her π«Ά
πΈ NAME πΈ
wrapping_assign_sub β intentionally perform a wrapping decrement assign π
(yes, intentionally. she knows exactly what she's doing.)
β¨ SYNOPSIS β¨
wrapping_assign_sub (var , offset );
that's it. that's the whole vibe. two args, zero drama π
π¦ ARGUMENTS π¦
varβ the variable that's getting decremented. she's the main character here πoffsetβ how much you're subtracting from her. the amount, the whole amount, nothing but the amount π
π₯ DESCRIPTION π₯
so what she does is: decrements var by offset, with wrap-around. literally that's the assignment. returns the resulting value of var. π«
and the iconic part? will not trip any wrap-around sanitizers. not a single one. she said "i'm not setting off any alarms today" and she meant it π
also, to be super clear since the manpage says it twice (she's thorough, we love her): returns the new value of var. β
likeβ¦ it's giving "small function, big confidence." one job, done flawlessly, no sanitizer crying in the group chat ππ
π§ SEE ALSO π§
all her besties live in the kernel file ./include/linux/overflow.h and honestly the whole friend group is iconic π:
check_add_overflow(9)wrapping_add(9)wrapping_assign_add(9)check_sub_overflow(9)wrapping_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 read them all, iykwim ππ
and that's the whole page, bestie!! π this little gem comes to you from ./include/linux, dated October 2026 β go off, queen, slay the wrap-around, periodt π
β¨πΈ
π¦ 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