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: <ZBr2XZr25jwAp3kO@nvidia.com>
Date:   Wed, 22 Mar 2023 09:36:45 -0300
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Lu Baolu <baolu.lu@...ux.intel.com>
Cc:     Joerg Roedel <joro@...tes.org>,
        Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
        Robin Murphy <robin.murphy@....com>,
        Christoph Hellwig <hch@...radead.org>,
        Kevin Tian <kevin.tian@...el.com>,
        Will Deacon <will@...nel.org>, iommu@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] iommu: Use sysfs_emit() for sysfs show

On Wed, Mar 22, 2023 at 08:34:21PM +0800, Lu Baolu wrote:
> Use sysfs_emit() instead of the sprintf() for sysfs entries. sysfs_emit()
> knows the maximum of the temporary buffer used for outputting sysfs
> content and avoids overrunning the buffer length.
> 
> Prefer 'long long' over 'long long int' as suggested by checkpatch.pl.
> 
> Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
> ---
>  drivers/iommu/amd/init.c    |  4 ++--
>  drivers/iommu/intel/iommu.c | 17 +++++++++--------
>  drivers/iommu/iommu.c       | 31 +++++++++++++++----------------
>  3 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
> index 19a46b9f7357..a98202018140 100644
> --- a/drivers/iommu/amd/init.c
> +++ b/drivers/iommu/amd/init.c
> @@ -1941,7 +1941,7 @@ static ssize_t amd_iommu_show_cap(struct device *dev,
>  				  char *buf)
>  {
>  	struct amd_iommu *iommu = dev_to_amd_iommu(dev);
> -	return sprintf(buf, "%x\n", iommu->cap);
> +	return sysfs_emit(buf, "%x\n", iommu->cap);
>  }

It would be nice to add the missing whitespace after declarations here
and other places to follow the coding convention

The conversions look OK though

Reviewed-by: Jason Gunthorpe <jgg@...dia.com>

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ