Skip to content

Commit

Permalink
media: cec-core: fix a bug at cec_error_inj_write()
Browse files Browse the repository at this point in the history
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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
  • Loading branch information
Mauro Carvalho Chehab committed Mar 23, 2018
1 parent afdb4ca commit 98c1ce0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/media/cec/cec-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 98c1ce0

Please sign in to comment.