lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fc8504b8-d8a9-4232-9d80-3681551a6de0@vivo.com>
Date: Thu, 21 Aug 2025 14:54:32 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Andy Shevchenko <andriy.shevchenko@...el.com>,
 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


在 2025/8/21 12:39, Andy Shevchenko 写道:
> On Thu, Aug 21, 2025 at 6:27 AM Qianfeng Rong <rongqianfeng@...o.com> wrote:
>> 在 2025/8/20 23:05, Andy Shevchenko 写道:
>>> On Sun, Aug 17, 2025 at 05:29:39PM +0800, Qianfeng Rong wrote:
> ...
>
>>>> -    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),
> Preference for sizeof(*...) is for a reason, and main one is the
> robustness against type changes. The shortened line is a bonus.
After checking some references, I confirm that what you said is correct.
I will send version 2. Thank you very much.
>
>> but using sizeof(*ptr) here shortens the line and
>> is indeed better.
>>
Best regards,
Qianfeng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ