On Mon, Nov 25, 2024 at 09:49:22AM +0200, Andy Shevchenko wrote: > On Sun, Nov 24, 2024 at 07:03:36AM +0000, Dmitry Torokhov wrote: > > On Sun, Nov 24, 2024 at 01:35:23AM +0530, Raag Jadav wrote: > > > Introduce '_array' variant of devm_kmemdup() for the users which lack > > > multiplication overflow check. > > > > I am not sure that this new helper is needed. Unlike allocators for > > brand new objects, such as kmalloc_array(), devm_kmemdup() makes a copy > > of already existing object, which is supposed to be a valid object and > > therefore will have a reasonable size. So there should be no chance for > > hitting this overflow unless the caller is completely confused and calls > > devm_kmemdup() with random arguments (in which case all bets are off). > > Don't we want to have a code more robust even if all what you say applies? > Also this makes the call consistent with zillions of others from the alloc > family of calls in the Linux kernel. Agree. Although shooting in the foot is never the expectation, it is atleast better than having to debug such unexpected cases. Raag