On 2020-09-24 18:46, Douglas Gilbert wrote: > /* Check for integer overflow */ > if (length > (nent << (PAGE_SHIFT + order))) > return NULL; > > Well _integers_ don't wrap, but that pedantic point aside, 'nent' is an > unsigned int which means the rhs expression cannot represent 2^32 or > higher. So if length >= 2^32 the function fails (i.e. returns NULL). > > On 8 GiB and 16 GiB machines I can easily build 6 or 12 GiB sgl_s (with > scsi_debug) but only if no single allocation is >= 4 GiB due to the > above check. > > So is the above check intended to do that or is it a bug? The above check verifies that nent << (PAGE_SHIFT + order) == (uint64_t)nent << (PAGE_SHIFT + order). So I think it does what the comment says it does. Bart.