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: <4pryydyzfpvb75mityltxvj6blfdcvsdngwmnzprnqjlldhxog@kpsf5mx3coi7>
Date: Thu, 21 Aug 2025 05:23:50 +0000
From: Ankit Soni <Ankit.Soni@....com>
To: David Laight <david.laight.linux@...il.com>
CC: Xichao Zhao <zhao.xichao@...o.com>, <joro@...tes.org>, <will@...nel.org>,
	<suravee.suthikulpanit@....com>, <robin.murphy@....com>,
	<iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iommu/amd: use str_plural() to simplify the code

On Wed, Aug 20, 2025 at 07:03:59PM +0100, David Laight wrote:
> On Mon, 18 Aug 2025 11:53:31 +0800
> Xichao Zhao <zhao.xichao@...o.com> wrote:
> 
> > Use the string choice helper function str_plural() to simplify the code.
> 
> This also changes (maybe fixes) the code my adding "s" for zero.
> 
> Although I'd define it as ("s" + !!count) - almost certainly generates
> better code.
> 
> 	David
> 

Hi,
In case of hid_count is 0, below condition (before fw_bug check) will hit.
		if (!p1)
	                return -EINVAL;

Apart from this, i dont see hid_count will remain 0.

-Ankit

> > 
> > Signed-off-by: Xichao Zhao <zhao.xichao@...o.com>
> > ---
> >  drivers/iommu/amd/iommu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> > index eb348c63a8d0..b5c829f89544 100644
> > --- a/drivers/iommu/amd/iommu.c
> > +++ b/drivers/iommu/amd/iommu.c
> > @@ -265,7 +265,7 @@ static inline int get_acpihid_device_id(struct device *dev,
> >  		return -EINVAL;
> >  	if (fw_bug)
> >  		dev_err_once(dev, FW_BUG "No ACPI device matched UID, but %d device%s matched HID.\n",
> > -			     hid_count, hid_count > 1 ? "s" : "");
> > +			     hid_count,  str_plural(hid_count));
> >  	if (hid_count > 1)
> >  		return -EINVAL;
> >  	if (entry)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ