leds: lp55xx: fix the sysfs read operation

According to a sysfs documentation(Documentation/filesystem/sysfs.txt),
scnprintf() should be used in a read operation method.
It guarantees safe buffer size(PAGE_SIZE) which is allocated by the sysfs.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
This commit is contained in:
Kim, Milo
2013-03-14 17:19:36 -07:00
committed by Bryan Wu
parent 313bf0b1a0
commit 24d3212847
2 changed files with 4 additions and 3 deletions

View File

@@ -360,7 +360,8 @@ static ssize_t lp5521_selftest(struct device *dev,
mutex_lock(&chip->lock);
ret = lp5521_run_selftest(chip, buf);
mutex_unlock(&chip->lock);
return sprintf(buf, "%s\n", ret ? "FAIL" : "OK");
return scnprintf(buf, PAGE_SIZE, "%s\n", ret ? "FAIL" : "OK");
}
/* device attributes */