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

From: Richard Weinberger
Date: Tue Jun 07 2022 - 21:48:29 EST


----- Ursprüngliche Mail -----
> Von: "Michał Kępień" <kernel@xxxxxxxxxx>
> An: "Miquel Raynal" <miquel.raynal@xxxxxxxxxxx>, "richard" <richard@xxxxxx>, "Vignesh Raghavendra" <vigneshr@xxxxxx>
> CC: "linux-mtd" <linux-mtd@xxxxxxxxxxxxxxxxxxx>, "linux-kernel" <linux-kernel@xxxxxxxxxxxxxxx>
> Gesendet: Montag, 16. Mai 2022 09:06:01
> Betreff: [PATCH 2/2] mtdchar: use kvmalloc() for potentially large allocations

> 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>

Looks good to me.
Acked-by: Richard Weinberger <richard@xxxxxx>

Thanks,
//richard