提交 98c1ce0c 编写于 作者: M Mauro Carvalho Chehab

media: cec-core: fix a bug at cec_error_inj_write()

If the adapter doesn't have error_inj_parse_line() ops, the
write() logic won't return -EINVAL, but, instead, it will keep
looping, because "count" is a non-negative number.
Reviewed-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 afdb4ca2
......@@ -209,14 +209,14 @@ static ssize_t cec_error_inj_write(struct file *file,
if (IS_ERR(buf))
return PTR_ERR(buf);
p = buf;
while (p && *p && count >= 0) {
while (p && *p) {
p = skip_spaces(p);
line = strsep(&p, "\n");
if (!*line || *line == '#')
continue;
if (!adap->ops->error_inj_parse_line(adap, line)) {
count = -EINVAL;
break;
kfree(buf);
return -EINVAL;
}
}
kfree(buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册