lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <0b350326a7dcf246c8a63449b35e9ea4@208suo.com>
Date:   Wed, 14 Jun 2023 14:19:51 +0800
From:   wuyonggang001@...suo.com
To:     jikos@...nel.org, benjamin.tissoires@...hat.com
Cc:     linux-kernel@...r.kernel.org, linux-input@...r.kernel.org
Subject: [PATCH] HID: lenovo: Replacing snprintf with scnprintf

Fix the following coccicheck warning:

drivers/hid/hid-lenovo.c:786:8-16: WARNING: use scnprintf or sprintf

Signed-off-by: Yonggang Wu <wuyonggang001@...suo.com>
---
  drivers/hid/hid-lenovo.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 44763c0da444..147fcf69d235 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -537,7 +537,7 @@ static ssize_t attr_fn_lock_show(struct device *dev,
      struct hid_device *hdev = to_hid_device(dev);
      struct lenovo_drvdata *data = hid_get_drvdata(hdev);

-    return snprintf(buf, PAGE_SIZE, "%u\n", data->fn_lock);
+    return scnprintf(buf, PAGE_SIZE, "%u\n", data->fn_lock);
  }

  static ssize_t attr_fn_lock_store(struct device *dev,
@@ -581,7 +581,7 @@ static ssize_t attr_sensitivity_show_cptkbd(struct 
device *dev,
      struct hid_device *hdev = to_hid_device(dev);
      struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev);

-    return snprintf(buf, PAGE_SIZE, "%u\n",
+    return scnprintf(buf, PAGE_SIZE, "%u\n",
          cptkbd_data->sensitivity);
  }

@@ -753,7 +753,7 @@ static ssize_t 
attr_press_to_select_show_tpkbd(struct device *dev,
      struct hid_device *hdev = to_hid_device(dev);
      struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);

-    return snprintf(buf, PAGE_SIZE, "%u\n", 
data_pointer->press_to_select);
+    return scnprintf(buf, PAGE_SIZE, "%u\n", 
data_pointer->press_to_select);
  }

  static ssize_t attr_press_to_select_store_tpkbd(struct device *dev,
@@ -783,7 +783,7 @@ static ssize_t attr_dragging_show_tpkbd(struct 
device *dev,
      struct hid_device *hdev = to_hid_device(dev);
      struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);

-    return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging);
+    return scnprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging);
  }

  static ssize_t attr_dragging_store_tpkbd(struct device *dev,
@@ -813,7 +813,7 @@ static ssize_t 
attr_release_to_select_show_tpkbd(struct device *dev,
      struct hid_device *hdev = to_hid_device(dev);
      struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);

-    return snprintf(buf, PAGE_SIZE, "%u\n", 
data_pointer->release_to_select);
+    return scnprintf(buf, PAGE_SIZE, "%u\n", 
data_pointer->release_to_select);
  }

  static ssize_t attr_release_to_select_store_tpkbd(struct device *dev,
@@ -843,7 +843,7 @@ static ssize_t attr_select_right_show_tpkbd(struct 
device *dev,
      struct hid_device *hdev = to_hid_device(dev);
      struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);

-    return snprintf(buf, PAGE_SIZE, "%u\n", 
data_pointer->select_right);
+    return scnprintf(buf, PAGE_SIZE, "%u\n", 
data_pointer->select_right);
  }

  static ssize_t attr_select_right_store_tpkbd(struct device *dev,
@@ -873,7 +873,7 @@ static ssize_t attr_sensitivity_show_tpkbd(struct 
device *dev,
      struct hid_device *hdev = to_hid_device(dev);
      struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);

-    return snprintf(buf, PAGE_SIZE, "%u\n",
+    return scnprintf(buf, PAGE_SIZE, "%u\n",
          data_pointer->sensitivity);
  }

@@ -902,7 +902,7 @@ static ssize_t attr_press_speed_show_tpkbd(struct 
device *dev,
      struct hid_device *hdev = to_hid_device(dev);
      struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);

-    return snprintf(buf, PAGE_SIZE, "%u\n",
+    return scnprintf(buf, PAGE_SIZE, "%u\n",
          data_pointer->press_speed);
  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ