Skip to content

Commit d360185

Browse files
tititiou36broonie
authored andcommitted
regmap: debugfs: Fix a erroneous check after snprintf()
This error handling looks really strange. Check if the string has been truncated instead. Fixes: f0c2319 ("regmap: Expose the driver name in debugfs") Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/8595de2462c490561f70020a6d11f4d6b652b468.1693857825.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <[email protected]>
1 parent 0bb80ec commit d360185

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/regmap/regmap-debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static ssize_t regmap_name_read_file(struct file *file,
4848
name = map->dev->driver->name;
4949

5050
ret = snprintf(buf, PAGE_SIZE, "%s\n", name);
51-
if (ret < 0) {
51+
if (ret >= PAGE_SIZE) {
5252
kfree(buf);
5353
return ret;
5454
}

0 commit comments

Comments
 (0)