Messages in this thread | | | Date | Wed, 22 Mar 2023 09:36:45 -0300 | From | Jason Gunthorpe <> | 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@linux.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@nvidia.com>
Jason
| |