[<prev] [next>] [day] [month] [year] [list]
Message-ID: <dec39ad58f9c6592a2c505a17930a5ec@208suo.com>
Date: Mon, 17 Jul 2023 11:43:38 +0800
From: hanyu001@...suo.com
To: kashyap.desai@...adcom.com, jejb@...ux.ibm.com,
martin.petersen@...cle.com
Cc: megaraidlinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: megaraid: Convert snprintf to scnprintf
Fix the following coccicheck warnings:
drivers/scsi/megaraid/megaraid_sas_base.c:3422:WARNING: use scnprintf or
sprintf
drivers/scsi/megaraid/megaraid_sas_base.c:3412:WARNING: use scnprintf or
sprintf
drivers/scsi/megaraid/megaraid_sas_base.c:3338:WARNING: use scnprintf or
sprintf
drivers/scsi/megaraid/megaraid_sas_base.c:3385:WARNING: use scnprintf or
sprintf
drivers/scsi/megaraid/megaraid_sas_base.c:3402:WARNING: use scnprintf or
sprintf
drivers/scsi/megaraid/megaraid_sas_base.c:3392:WARNING: use scnprintf or
sprintf
drivers/scsi/megaraid/megaraid_sas_base.c:3476:WARNING: use scnprintf or
sprintf
Signed-off-by: ztt <1549089851@...com>
---
drivers/scsi/megaraid/megaraid_sas_base.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 050eed8e2684..da7931ba4261 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3335,7 +3335,7 @@ fw_crash_buffer_size_show(struct device *cdev,
struct megasas_instance *instance =
(struct megasas_instance *) shost->hostdata;
- return snprintf(buf, PAGE_SIZE, "%ld\n", (unsigned long)
+ return scnprintf(buf, PAGE_SIZE, "%ld\n", (unsigned long)
((instance->fw_crash_buffer_size) * 1024 * 1024)/PAGE_SIZE);
}
@@ -3382,14 +3382,14 @@ fw_crash_state_show(struct device *cdev,
struct megasas_instance *instance =
(struct megasas_instance *) shost->hostdata;
- return snprintf(buf, PAGE_SIZE, "%d\n", instance->fw_crash_state);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", instance->fw_crash_state);
}
static ssize_t
page_size_show(struct device *cdev,
struct device_attribute *attr, char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%ld\n", (unsigned long)PAGE_SIZE -
1);
+ return scnprintf(buf, PAGE_SIZE, "%ld\n", (unsigned long)PAGE_SIZE
- 1);
}
static ssize_t
@@ -3399,7 +3399,7 @@ ldio_outstanding_show(struct device *cdev, struct
device_attribute *attr,
struct Scsi_Host *shost = class_to_shost(cdev);
struct megasas_instance *instance = (struct megasas_instance
*)shost->hostdata;
- return snprintf(buf, PAGE_SIZE, "%d\n",
atomic_read(&instance->ldio_outstanding));
+ return scnprintf(buf, PAGE_SIZE, "%d\n",
atomic_read(&instance->ldio_outstanding));
}
static ssize_t
@@ -3409,7 +3409,7 @@ fw_cmds_outstanding_show(struct device *cdev,
struct Scsi_Host *shost = class_to_shost(cdev);
struct megasas_instance *instance = (struct megasas_instance
*)shost->hostdata;
- return snprintf(buf, PAGE_SIZE, "%d\n",
atomic_read(&instance->fw_outstanding));
+ return scnprintf(buf, PAGE_SIZE, "%d\n",
atomic_read(&instance->fw_outstanding));
}
static ssize_t
@@ -3419,7 +3419,7 @@ enable_sdev_max_qd_show(struct device *cdev,
struct Scsi_Host *shost = class_to_shost(cdev);
struct megasas_instance *instance = (struct megasas_instance
*)shost->hostdata;
- return snprintf(buf, PAGE_SIZE, "%d\n",
instance->enable_sdev_max_qd);
+ return scnprintf(buf, PAGE_SIZE, "%d\n",
instance->enable_sdev_max_qd);
}
static ssize_t
@@ -3473,7 +3473,7 @@ raid_map_id_show(struct device *cdev, struct
device_attribute *attr,
struct megasas_instance *instance =
(struct megasas_instance *)shost->hostdata;
- return snprintf(buf, PAGE_SIZE, "%ld\n",
+ return scnprintf(buf, PAGE_SIZE, "%ld\n",
(unsigned long)instance->map_id);
}
Powered by blists - more mailing lists