From: Qianfeng Rong <rongqianfeng@vivo.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Andy Shevchenko <andy@kernel.org>,
Hans de Goede <hansg@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Colin Ian King <colin.i.king@gmail.com>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: Re: [PATCH] media: atomisp: use kmalloc_array() for array space allocation
Date: Thu, 21 Aug 2025 11:27:25 +0800 [thread overview]
Message-ID: <9a289ccf-47b1-4e24-b317-53aaa166bb83@vivo.com> (raw)
In-Reply-To: <aKXkQ0WXaG-hMgEW@smile.fi.intel.com>
在 2025/8/20 23:05, Andy Shevchenko 写道:
> 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.
I prefer sizeof(type), but using sizeof(*ptr) here shortens the line and
is indeed better.
Best regards,
Qianfeng
next prev parent reply other threads:[~2025-08-21 3:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-17 9:29 Qianfeng Rong
2025-08-20 15:05 ` Andy Shevchenko
2025-08-21 3:27 ` Qianfeng Rong [this message]
2025-08-21 4:39 ` Andy Shevchenko
2025-08-21 6:54 ` Qianfeng Rong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9a289ccf-47b1-4e24-b317-53aaa166bb83@vivo.com \
--to=rongqianfeng@vivo.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=colin.i.king@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®