提交 cb412a8d 编写于 作者: C Cyril Roelandt 提交者: Mauro Carvalho Chehab

[media] staging/media/solo6x10/v4l2-enc.c: fix error-handling

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: NCyril Roelandt <tipecaml@gmail.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 899a179d
...@@ -1619,6 +1619,8 @@ static int solo_s_ext_ctrls(struct file *file, void *priv, ...@@ -1619,6 +1619,8 @@ static int solo_s_ext_ctrls(struct file *file, void *priv,
solo_enc->osd_text[OSD_TEXT_MAX] = '\0'; solo_enc->osd_text[OSD_TEXT_MAX] = '\0';
if (!err) if (!err)
err = solo_osd_print(solo_enc); err = solo_osd_print(solo_enc);
else
err = -EFAULT;
} }
break; break;
default: default:
...@@ -1654,6 +1656,8 @@ static int solo_g_ext_ctrls(struct file *file, void *priv, ...@@ -1654,6 +1656,8 @@ static int solo_g_ext_ctrls(struct file *file, void *priv,
err = copy_to_user(ctrl->string, err = copy_to_user(ctrl->string,
solo_enc->osd_text, solo_enc->osd_text,
OSD_TEXT_MAX); OSD_TEXT_MAX);
if (err)
err = -EFAULT;
} }
break; break;
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册