diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2017-03-06 19:34:48 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-03-07 15:07:21 +0300 |
commit | b7cd1b1386ff46e60452ad1f16530645761ca7b8 (patch) | |
tree | 7d567e8598c68bf35130287c22abec14976e158a /drivers/regulator | |
parent | c1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201 (diff) | |
download | linux-b7cd1b1386ff46e60452ad1f16530645761ca7b8.tar.xz |
regulator: core: use snprintf() instead of scnprintf()
When creating the link to the device sysfs entry, the regulator core
calls scnprintf() and then checks if the returned value is greater or
equal than the buffer size.
The former can never happen as scnprintf() returns the number of bytes
that were actually written to the buffer, not the bytes that *would*
have been written.
Use the right function in this case: snprintf().
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 53d4fc70dbd0..f20ad0a8fc38 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1326,8 +1326,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, regulator->dev = dev; /* Add a link to the device sysfs entry */ - size = scnprintf(buf, REG_STR_SIZE, "%s-%s", - dev->kobj.name, supply_name); + size = snprintf(buf, REG_STR_SIZE, "%s-%s", + dev->kobj.name, supply_name); if (size >= REG_STR_SIZE) goto overflow_err; |