CC: [email protected]
TO: Denis Efremov <[email protected]>
CC: Julia Lawall <[email protected]>
CC: Alim Akhtar <[email protected]>
CC: Avri Altman <[email protected]>
CC: "James E.J. Bottomley" <[email protected]>
CC: "Martin K. Petersen" <[email protected]>
CC: Stanley Chu <[email protected]>
CC: Can Guo <[email protected]>
CC: Bean Huo <[email protected]>
CC: Bart Van Assche <[email protected]>

From: kernel test robot <[email protected]>

drivers/scsi/ufs/ufshcd.c:1749:8-16: WARNING: use scnprintf or sprintf
drivers/scsi/ufs/ufshcd.c:1772:8-16: WARNING: use scnprintf or sprintf
drivers/scsi/ufs/ufshcd.c:1460:8-16: WARNING: use scnprintf or sprintf


 From Documentation/filesystems/sysfs.txt:
  show() must not use snprintf() when formatting the value to be
  returned to user space. If you can guarantee that an overflow
  will never happen you can use sprintf() otherwise you must use
  scnprintf().

Generated by: scripts/coccinelle/api/device_attr_show.cocci

Fixes: 988676da8375 ("coccinelle: api: add device_attr_show script")
CC: Denis Efremov <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git 
for-5.9
head:   89c775cf9e2b970ac05b0f659597a114da2457de
commit: 988676da837516bbfafda5478472fd4265f0de4e [1/7] coccinelle: api: add 
device_attr_show script
:::::: branch date: 2 days ago
:::::: commit date: 5 weeks ago

Please take the patch only if it's a positive warning. Thanks!

 ufshcd.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1457,7 +1457,7 @@ static ssize_t ufshcd_clkscale_enable_sh
 {
        struct ufs_hba *hba = dev_get_drvdata(dev);
 
-       return snprintf(buf, PAGE_SIZE, "%d\n", hba->clk_scaling.is_allowed);
+       return scnprintf(buf, PAGE_SIZE, "%d\n", hba->clk_scaling.is_allowed);
 }
 
 static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
@@ -1746,7 +1746,7 @@ static ssize_t ufshcd_clkgate_delay_show
 {
        struct ufs_hba *hba = dev_get_drvdata(dev);
 
-       return snprintf(buf, PAGE_SIZE, "%lu\n", hba->clk_gating.delay_ms);
+       return scnprintf(buf, PAGE_SIZE, "%lu\n", hba->clk_gating.delay_ms);
 }
 
 static ssize_t ufshcd_clkgate_delay_store(struct device *dev,
@@ -1769,7 +1769,7 @@ static ssize_t ufshcd_clkgate_enable_sho
 {
        struct ufs_hba *hba = dev_get_drvdata(dev);
 
-       return snprintf(buf, PAGE_SIZE, "%d\n", hba->clk_gating.is_enabled);
+       return scnprintf(buf, PAGE_SIZE, "%d\n", hba->clk_gating.is_enabled);
 }
 
 static ssize_t ufshcd_clkgate_enable_store(struct device *dev,
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to