[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aKXkQ0WXaG-hMgEW@smile.fi.intel.com>
Date: Wed, 20 Aug 2025 18:05:39 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Qianfeng Rong <rongqianfeng@...o.com>
Cc: Andy Shevchenko <andy@...nel.org>, Hans de Goede <hansg@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Colin Ian King <colin.i.king@...il.com>,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
linux-staging@...ts.linux.dev
Subject: Re: [PATCH] media: atomisp: use kmalloc_array() for array space
allocation
On Sun, Aug 17, 2025 at 05:29:39PM +0800, Qianfeng Rong wrote:
> Replace kmalloc(count * sizeof) with kmalloc_array() for safer memory
> allocation and overflow prevention.
...
> - descr->in_info = kmalloc(descr->num_stage *
> - sizeof(struct ia_css_frame_info),
> - GFP_KERNEL);
> + descr->in_info = kmalloc_array(descr->num_stage,
> + sizeof(struct ia_css_frame_info),
> + GFP_KERNEL);
At the same time it would be nice to use sizeof(*...) variants instead of using
type-based.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists