range_end_overflows(9)
π range_end_overflows(9) β the kernel API manual, bestie edition β¨
Okay so we're in the kernel API manual today and the star of the show is range_end_overflows(9). Yes it's a mouthful, yes it's iconic, no we're not skipping it. Let's get into it π
β¨ NAME β¨
range_end_overflows β literally just checks if a range's endpoint is out of bounds. That's it. That's the whole gig π«Ά
πΈ SYNOPSIS πΈ
range_end_overflows (start , size , max );
Look at her. Three little args. No cap, she's doing the most with the least π
π¦ ARGUMENTS π¦
startβ where the range starts, bestie. The beginning. The origin story β¨sizeβ how big the range is. How much we're working with πmaxβ the exclusive upper boundary. Not inclusive, exclusive β she's got boundaries and she's sticking to them π
π DESCRIPTION π
So here's the tea: this function checks only if the endpoint of a range (start + size) exceeds max. Just the endpoint. Not the whole situation. Not the vibes. The endpoint π₯
And here's the part where she's different from her sibling, okay? Unlike range_overflows, a zero-sized range at the boundary (i.e. start == max) is not considered an overflow. Not even a little. She's like "that's fine actually, that's valid π§"
Which makes her super useful for iterator-style checks β you know, that whole checking-as-you-go lifestyle. iykyk β
π RETURN π
Returns true if the endpoint exceeds the boundary. That's the whole return. Very "yes or no, no in-between" of her π
π SEE ALSO π
Kernel file <pink>./include/linux/overflow.h</pink> β and honestly the whole overflow friend group, they all show up together:
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)check_shl_overflow(9)overflows_type(9)range_overflows(9)range_overflows_t(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)
Yeah that's the whole squad. Go read literally all of them, they all ate π
Reminder bestie:maxis exclusive, and starting atmaxwithsizeof zero is fine. Don't be out here calling that an overflow, that's not the assignment π
Okay that's the page!! This one lives in ./include/linux and the version/date on the door says October 2026, and yes her full name tag still reads range_end_overflows(9). Mwah, go forth and check those endpoints πβ¨
π¦ 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