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: <bnkx654tvfekhgragyuwseg7sxcrgrnb4bvwe5bgxikaf7k2ew@kf7jb76zrf3r>
Date: Mon, 10 Nov 2025 10:34:10 -0600
From: Bjorn Andersson <andersson@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Stefan Wahren <wahrenst@....net>, Vinod Koul <vkoul@...nel.org>, 
	Thomas Andreatta <thomasandreatta2000@...il.com>, Caleb Sander Mateos <csander@...estorage.com>, 
	dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-rpi-kernel@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org, 
	linux-arm-msm@...r.kernel.org, Olivier Dautricourt <olivierdautricourt@...il.com>, 
	Stefan Roese <sr@...x.de>, Florian Fainelli <florian.fainelli@...adcom.com>, 
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>, Ray Jui <rjui@...adcom.com>, 
	Scott Branden <sbranden@...adcom.com>, Lars-Peter Clausen <lars@...afoo.de>, 
	Eugeniy Paltsev <Eugeniy.Paltsev@...opsys.com>, Daniel Mack <daniel@...que.org>, 
	Haojian Zhuang <haojian.zhuang@...il.com>, Robert Jarzmik <robert.jarzmik@...e.fr>, 
	Lizhi Hou <lizhi.hou@....com>, Brian Xu <brian.xu@....com>, 
	Raj Kumar Rampelli <raj.kumar.rampelli@....com>, Michal Simek <michal.simek@....com>, 
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2 01/13] scatterlist: introduce sg_nents_for_dma() helper

On Mon, Nov 10, 2025 at 05:33:29PM +0200, Andy Shevchenko wrote:
> On Mon, Nov 10, 2025 at 09:21:18AM -0600, Bjorn Andersson wrote:
> > On Mon, Nov 10, 2025 at 09:05:26AM -0600, Bjorn Andersson wrote:
> > > On Mon, Nov 10, 2025 at 11:23:28AM +0100, Andy Shevchenko wrote:
> 
> ...
> 
> > > >  int sg_nents(struct scatterlist *sg);
> > > >  int sg_nents_for_len(struct scatterlist *sg, u64 len);
> > > > +int sg_nents_for_dma(struct scatterlist *sgl, unsigned int sglen, size_t len);
> 
> 
> ^^^
> 
> > > > +int sg_nents_for_dma(struct scatterlist *sgl, unsigned int sglen, size_t len)
> > 
> > All but two clients store the value in an unsigned int. Changing the
> > return type to unsigned int also signals that the function is just
> > returning a count (no errors).
> 
> The type is chosen for the consistency with the existing APIs.
> So, I prefer consistency in this case, if we need to change type, we need to do
> that for all above APIs I believe. And this is out of the scope here.
> 

That makes sense, after a second look I agree with your decision.

Regards,
Bjorn

> Personally I was also puzzled of the choice as *nents members are all unsigned
> int in the scatterlist.h.
> 
> ...
> 
> > > We need an EXPORT_SYMBOL() here.
> 
> Good catch! I'll add it in next version.
> 
> > > With that, this looks good to me.
> > > 
> > > Reviewed-by: Bjorn Andersson <andersson@...nel.org>
> 
> Thanks!
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ