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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6Cnt-bkOEOsUVtG@smile.fi.intel.com>
Date: Mon, 3 Feb 2025 13:25:43 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: Raag Jadav <raag.jadav@...el.com>, gregkh@...uxfoundation.org,
	rafael@...nel.org, linus.walleij@...aro.org,
	mika.westerberg@...ux.intel.com, dmitry.torokhov@...il.com,
	lgirdwood@...il.com, broonie@...nel.org, sre@...nel.org,
	jic23@...nel.org, przemyslaw.kitszel@...el.com,
	linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-input@...r.kernel.org, linux-sound@...r.kernel.org,
	linux-pm@...r.kernel.org, linux-iio@...r.kernel.org
Subject: Re: [PATCH v3 14/20] iio: adc: xilinx-xadc-core: use
 devm_kmemdup_array()

On Mon, Feb 03, 2025 at 11:14:58AM +0000, Jonathan Cameron wrote:
> On Mon, 3 Feb 2025 12:42:36 +0200
> Raag Jadav <raag.jadav@...el.com> wrote:
> > On Mon, Feb 03, 2025 at 11:54:42AM +0200, Andy Shevchenko wrote:
> > > On Mon, Feb 03, 2025 at 01:38:56PM +0530, Raag Jadav wrote:  
> > > > Convert to use devm_kmemdup_array() which is more robust.  

...

> > > > -	channels = devm_kmemdup(dev, channel_templates,
> > > > -				sizeof(channels[0]) * max_channels, GFP_KERNEL);
> > > > +	channels = devm_kmemdup_array(dev, channel_templates, max_channels,
> > > > +				      sizeof(channels[0]), GFP_KERNEL);  
> > > 
> > > I would use more regular sizeof(*channels)  
> > 
> > This might get confusing since we're assigning it back to channels.
> > 
> It looks like standard pattern.  Assign X * the thing to the thing.
> 
> So I'd prefer sizeof(*channels) here as well.

Yeah, but the problem with kmemdup() family of APIs is that we need to pass
the source size if we want to have 1:1 copy. So, sizeof(*channel_templates)
is more accurate in my opinion.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ