summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2023-09-04 22:04:06 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-20 10:29:17 +0100
commitbe2dfa39068d054c4a63d89ad9e97ae3868d2b16 (patch)
treed0a11642161af9cbd53b36736f1fe84f7ff3dd5d
parentc373feafd7058501d149c1d832d24a9a8319c7b7 (diff)
downloadlinux-stable-be2dfa39068d054c4a63d89ad9e97ae3868d2b16.tar.gz
linux-stable-be2dfa39068d054c4a63d89ad9e97ae3868d2b16.tar.bz2
linux-stable-be2dfa39068d054c4a63d89ad9e97ae3868d2b16.zip
regmap: debugfs: Fix a erroneous check after snprintf()
[ Upstream commit d3601857e14de6369f00ae19564f1d817d175d19 ] This error handling looks really strange. Check if the string has been truncated instead. Fixes: f0c2319f9f19 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/base/regmap/regmap-debugfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index de706734b921..d114b614a3d1 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -53,7 +53,7 @@ static ssize_t regmap_name_read_file(struct file *file,
name = map->dev->driver->name;
ret = snprintf(buf, PAGE_SIZE, "%s\n", name);
- if (ret < 0) {
+ if (ret >= PAGE_SIZE) {
kfree(buf);
return ret;
}