check_shl_overflow(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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