sgl_alloc_order explicitly takes a 64-bit length (unsigned long long) butthen rejects it in overflow checking if greater than 4GiB allocation wasrequested. This is a consequence of using unsigned int for the right handside condition which then natuarally overflows when shifted left, earlierthan nent otherwise would.

Fix is to promote the right hand side of the conditional to unsigned long.

It is also not useful to allow for 64-bit lenght on 32-bit platforms soI have changed this type to a natural unsigned long. Like this it changessize naturally depending on the architecture.

2.

elem_len should not be explicitly sized u32 but unsigned int, to matchthe underlying struct scatterlist nents type. Same for the nent_p outputparameter type.

I renamed this to chunk_len and consolidated its use throughout thefunction.

3.

Eliminated nalloc local by re-arranging the code a bit.

4.

Tidied types in other helpers, replacing int with unsigned int whenpassing in back the nents returned from sgl_alloc_order. Again, this is tomatch the struct scatterlist underlying types.