lkml.org 
[lkml]   [2023]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] csi: myrs: Convert snprintf to scnprintf
Coccinelle reports: WARNING: use scnprintf or sprintf

Adding to that, there has also been some slow migration from snprintf to
scnprintf. This article explains the rationale for this change:
https: //lwn.net/Articles/69419/

Signed-off-by: RAN SUN <sunran001@208suo.com>
---
drivers/scsi/myrs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index a1eec65a9713..852aceb81f28 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -1408,7 +1408,8 @@ static ssize_t cache_size_show(struct device *dev,
struct Scsi_Host *shost = class_to_shost(dev);
struct myrs_hba *cs = shost_priv(shost);

- return snprintf(buf, 8, "%d MB\n", cs->ctlr_info->cache_size_mb);
+ return scnprintf(buf, 8, "%d MB\n", cs->ctlr_info->cache_size_mb);
+
}
static DEVICE_ATTR_RO(cache_size);
\
 
 \ /
  Last update: 2023-07-07 09:37    [W:0.048 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site