diff options
author | Juerg Haefliger <juerg.haefliger@canonical.com> | 2021-05-11 08:18:12 +0200 |
---|---|---|
committer | Wim Van Sebroeck <wim@linux-watchdog.org> | 2021-06-21 08:49:03 +0200 |
commit | 3bb21781d13516baf14dc051dbe2b3145c704cda (patch) | |
tree | 60a0b0c558688435c85d38bd5f6ae04e9fb34c0c /drivers/watchdog/watchdog_pretimeout.c | |
parent | watchdog: Fix possible use-after-free by calling del_timer_sync() (diff) | |
download | linux-3bb21781d13516baf14dc051dbe2b3145c704cda.tar.xz linux-3bb21781d13516baf14dc051dbe2b3145c704cda.zip |
watchdog: Use sysfs_emit() and sysfs_emit_at() in "show" functions
Convert sprintf() in sysfs "show" functions to sysfs_emit() and
sysfs_emit_at() in order to check for buffer overruns in sysfs outputs.
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210511061812.480172-1-juergh@canonical.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'drivers/watchdog/watchdog_pretimeout.c')
-rw-r--r-- | drivers/watchdog/watchdog_pretimeout.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/watchdog/watchdog_pretimeout.c b/drivers/watchdog/watchdog_pretimeout.c index 01ca84be240f..7f257c3485cd 100644 --- a/drivers/watchdog/watchdog_pretimeout.c +++ b/drivers/watchdog/watchdog_pretimeout.c @@ -55,7 +55,7 @@ int watchdog_pretimeout_available_governors_get(char *buf) mutex_lock(&governor_lock); list_for_each_entry(priv, &governor_list, entry) - count += sprintf(buf + count, "%s\n", priv->gov->name); + count += sysfs_emit_at(buf, count, "%s\n", priv->gov->name); mutex_unlock(&governor_lock); @@ -68,7 +68,7 @@ int watchdog_pretimeout_governor_get(struct watchdog_device *wdd, char *buf) spin_lock_irq(&pretimeout_lock); if (wdd->gov) - count = sprintf(buf, "%s\n", wdd->gov->name); + count = sysfs_emit(buf, "%s\n", wdd->gov->name); spin_unlock_irq(&pretimeout_lock); return count; |