* [PATCH] thunderbolt: debugfs: Fix uninitialized return in counters_write()
@ 2020-09-10 10:08 Dan Carpenter
2020-09-10 16:42 ` Mika Westerberg
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-09-10 10:08 UTC (permalink / raw)
To: Andreas Noever
Cc: Michael Jamet, Mika Westerberg, Yehezkel Bernat, Gil Fine,
Greg Kroah-Hartman, linux-usb, kernel-janitors
If the first line is in an invalid format then the "ret" value is
uninitialized. We should return -EINVAL instead.
Fixes: 54e418106c76 ("thunderbolt: Add debugfs interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/thunderbolt/debugfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
index fdfe6e4afbfe..3680b2784ea1 100644
--- a/drivers/thunderbolt/debugfs.c
+++ b/drivers/thunderbolt/debugfs.c
@@ -231,6 +231,7 @@ static ssize_t counters_write(struct file *file, const char __user *user_buf,
char *line = buf;
u32 val, offset;
+ ret = -EINVAL;
while (parse_line(&line, &offset, &val, 1, 4)) {
ret = tb_port_write(port, &val, TB_CFG_COUNTERS,
offset, 1);
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] thunderbolt: debugfs: Fix uninitialized return in counters_write()
2020-09-10 10:08 [PATCH] thunderbolt: debugfs: Fix uninitialized return in counters_write() Dan Carpenter
@ 2020-09-10 16:42 ` Mika Westerberg
0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2020-09-10 16:42 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat, Gil Fine,
Greg Kroah-Hartman, linux-usb, kernel-janitors
On Thu, Sep 10, 2020 at 01:08:05PM +0300, Dan Carpenter wrote:
> If the first line is in an invalid format then the "ret" value is
> uninitialized. We should return -EINVAL instead.
>
> Fixes: 54e418106c76 ("thunderbolt: Add debugfs interface")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-10 16:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 10:08 [PATCH] thunderbolt: debugfs: Fix uninitialized return in counters_write() Dan Carpenter
2020-09-10 16:42 ` Mika Westerberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).