check_shl_overflow(9)
π check_shl_overflow β the Kernel API Manual, bestie edition π
okay so real talk: this page is check_shl_overflow(9) from the Kernel API Manual, and it's genuinely one of the good ones. no cap. let's get into it π¦
β¨ NAME β¨
check_shl_overflow β literally just calculate a left-shifted value and check the overflow. that's the whole vibe. π
πΈ SYNOPSIS πΈ
check_shl_overflow (a , s , d );
yes bestie, that's the exact call, spacing and all. she's giving minimalism π₯
π«Ά ARGUMENTS π«Ά
aβ the value you're shifting. the main character of this operation πsβ how many bits left to shift. how far we're yeeting it, basically β¨dβ a pointer to where to store the result. this is where the answer lives afterward, so be nice to it π
π§ DESCRIPTION π§
so it computes:
*d = (a << s)
and then β this is the good part β it returns true if *d cannot hold the result, or when a << s doesn't make sense at all. like, the shift is nonsense. we love a function with boundaries π
here's where the example conditions go, and ngl the list came through blank in the source β four empty bullets, no content, not hiding anything from you:
- β¬οΈ
- β¬οΈ
- β¬οΈ
- β¬οΈ
fr fr bestie, those four bullets are literally empty on the original page. nothing got skipped, there's just nothing in them to skip π«Ά β and this is the exact count from the source, iykyk.
and the important bit: something is considered "safe for use" if true is returned. so true = "nope, don't trust that value", not "yay it worked". read the return value, bestie, i'm begging π
π SEE ALSO π
the kernel file lives at ./include/linux/overflow.h and it's a whole ecosystem, so here's the entire family β all of them, no skips, periodt:
check_add_overflow(9), wrapping_add(9), wrapping_assign_add(9), check_sub_overflow(9), wrapping_sub(9), wrapping_assign_sub(9), check_mul_overflow(9), wrapping_mul(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)
that's the whole crew. go say hi. π
π« cute little sign-off π«
this page shipped from ./include/linux, dated October 2026, and yes it's still called check_shl_overflow(9) β icon behavior only β go shift some bits responsibly, bestie, and check the overflow. slay π
β¨π
π¦ 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