Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,13 +805,12 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
* counters at a time, so make sure that isn't 0:
*/
nr_events = max(nr_events, num_possible_cpus() * 4);
nr_events *= 2;

/* Prevent overflows */
if (nr_events > (0x10000000U / sizeof(struct io_event))) {
if (nr_events > (0x8000000U / sizeof(struct io_event))) {
pr_debug("ENOMEM: nr_events too high\n");
return ERR_PTR(-EINVAL);
}
nr_events *= 2;

if (!nr_events || (unsigned long)max_reqs > aio_max_nr)
return ERR_PTR(-EAGAIN);
Expand Down
Loading