Skip to content

Commit

Permalink
[media] staging/media/solo6x10/v4l2-enc.c: fix error-handling
Browse files Browse the repository at this point in the history
The return values of copy_to_user() and copy_from_user() cannot be negative.
Found using the following semantich patch:
<spml>
@exists@
identifier ret;
statement S;
expression E;
@@
(
* ret = copy_to_user(...);
|
* ret = copy_from_user(...);
)
... when != ret = E
    when != if (ret) { <+... ret = E; ...+> }
* if (ret < 0)
  S
</spml>

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Cyril Roelandt authored and Mauro Carvalho Chehab committed Dec 26, 2012
1 parent 899a179 commit cb412a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/staging/media/solo6x10/v4l2-enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,8 @@ static int solo_s_ext_ctrls(struct file *file, void *priv,
solo_enc->osd_text[OSD_TEXT_MAX] = '\0';
if (!err)
err = solo_osd_print(solo_enc);
else
err = -EFAULT;
}
break;
default:
Expand Down Expand Up @@ -1654,6 +1656,8 @@ static int solo_g_ext_ctrls(struct file *file, void *priv,
err = copy_to_user(ctrl->string,
solo_enc->osd_text,
OSD_TEXT_MAX);
if (err)
err = -EFAULT;
}
break;
default:
Expand Down

0 comments on commit cb412a8

Please sign in to comment.