mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 23:23:03 +00:00
dbc48c8f41
nr_pages is unsigned long but gets passed to rb_alloc_aux() as an int,
and is stored as an int.
Only power-of-2 values are accepted, so if nr_pages is a 64_bit value, it
will be passed to rb_alloc_aux() as zero.
That is not ideal because:
1. the value is incorrect
2. rb_alloc_aux() is at risk of misbehaving, although it manages to
return -ENOMEM in that case, it is a result of passing zero to get_order()
even though the get_order() result is documented to be undefined in that
case.
Fix by simply validating the maximum supported value in the first place.
Use -ENOMEM error code for consistency with the current error code that
is returned in that case.
Fixes:
|
||
---|---|---|
.. | ||
callchain.c | ||
core.c | ||
hw_breakpoint_test.c | ||
hw_breakpoint.c | ||
internal.h | ||
Makefile | ||
ring_buffer.c | ||
uprobes.c |