[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210710164615.GA690067@pc>
Date: Sat, 10 Jul 2021 17:46:15 +0100
From: Salah Triki <salah.triki@...il.com>
To: dan.j.williams@...el.com, vishal.l.verma@...el.com,
dave.jiang@...el.com
Cc: nvdimm@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: [PATCH] dax: replace sprintf() by scnprintf()
Replace sprintf() by scnprintf() in order to avoid buffer overflows.
Signed-off-by: Salah Triki <salah.triki@...il.com>
---
drivers/dax/bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 5aee26e1bbd6..bcae4be6ae76 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -76,7 +76,7 @@ static ssize_t do_id_store(struct device_driver *drv, const char *buf,
fields = sscanf(buf, "dax%d.%d", ®ion_id, &id);
if (fields != 2)
return -EINVAL;
- sprintf(devname, "dax%d.%d", region_id, id);
+ scnprintf(devname, DAX_NAME_LEN, "dax%d.%d", region_id, id);
if (!sysfs_streq(buf, devname))
return -EINVAL;
--
2.25.1
Powered by blists - more mailing lists