diff mbox series

scsi: Convert snprintf to scnprintf

Message ID 7309ee79c3aa243c0b448746c76f1d9e@208suo.com
State New
Headers show
Series scsi: Convert snprintf to scnprintf | expand

Commit Message

hanyu001@208suo.com July 17, 2023, 3:03 a.m. UTC
Fix the coccicheck warnings:

./drivers/scsi/pmcraid.c:3591:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/pmcraid.c:3557:8-16: WARNING: use scnprintf or sprintf
./drivers/scsi/pmcraid.c:3496:8-16: WARNING: use scnprintf or sprintf

Signed-off-by: ztt <1549089851@qq.com>
---
  drivers/scsi/pmcraid.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)


  /**
@@ -3554,7 +3554,7 @@ static ssize_t pmcraid_show_drv_version(
      char *buf
  )
  {
-    return snprintf(buf, PAGE_SIZE, "version: %s\n",
+    return scnprintf(buf, PAGE_SIZE, "version: %s\n",
              PMCRAID_DRIVER_VERSION);
  }

@@ -3588,7 +3588,7 @@ static ssize_t pmcraid_show_adapter_id(
          pinstance->pdev->devfn;
      u32 aen_group = pmcraid_event_family.id;

-    return snprintf(buf, PAGE_SIZE,
+    return scnprintf(buf, PAGE_SIZE,
              "adapter id: %d\nminor: %d\naen group: %d\n",
              adapter_id, MINOR(pinstance->cdev.dev), aen_group);
  }
diff mbox series

Patch

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 9415a4819470..a65198a48b16 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3493,7 +3493,7 @@  static ssize_t pmcraid_show_log_level(
      struct Scsi_Host *shost = class_to_shost(dev);
      struct pmcraid_instance *pinstance =
          (struct pmcraid_instance *)shost->hostdata;
-    return snprintf(buf, PAGE_SIZE, "%d\n", 
pinstance->current_log_level);
+    return scnprintf(buf, PAGE_SIZE, "%d\n", 
pinstance->current_log_level);
  }