Re: [PATCH 2/2] mtdchar: use kvmalloc() for potentially large allocations

From: Miquel Raynal
Date: Thu Jun 09 2022 - 09:10:33 EST


On Mon, 2022-05-16 at 07:06:01 UTC, =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= wrote:
> mtdchar_write_ioctl() calls kmalloc() with the 'size' argument set to
> the smaller of two values: the write request's data/OOB length provided
> by user space and the erase block size of the MTD device. If the latter
> is large, kmalloc() may not be able to serve such allocation requests.
> Use kvmalloc() instead. Correspondingly, replace kfree() calls with
> kvfree() calls.
>
> Suggested-by: Richard Weinberger <richard@xxxxxx>
> Signed-off-by: Michał Kępień <kernel@xxxxxxxxxx>
> Acked-by: Richard Weinberger <richard@xxxxxx>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel