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

Miquel Raynal miquel.raynal at bootlin.com
Thu Jun 9 06:10:18 PDT 2022


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 at nod.at>
> Signed-off-by: Michał Kępień <kernel at kempniu.pl>
> Acked-by: Richard Weinberger <richard at nod.at>

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

Miquel



More information about the linux-mtd mailing list