mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
regmap: debugfs: Fix a erroneous check after snprintf()
This error handling looks really strange.
Check if the string has been truncated instead.
Fixes: f0c2319f9f
("regmap: Expose the driver name in debugfs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/8595de2462c490561f70020a6d11f4d6b652b468.1693857825.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
0bb80ecc33
commit
d3601857e1
1 changed files with 1 additions and 1 deletions
|
@ -48,7 +48,7 @@ static ssize_t regmap_name_read_file(struct file *file,
|
||||||
name = map->dev->driver->name;
|
name = map->dev->driver->name;
|
||||||
|
|
||||||
ret = snprintf(buf, PAGE_SIZE, "%s\n", name);
|
ret = snprintf(buf, PAGE_SIZE, "%s\n", name);
|
||||||
if (ret < 0) {
|
if (ret >= PAGE_SIZE) {
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue