media: pvrusb2: qctrl.flag will be uninitlaized if cx2341x_ctrl_query() returns error...
authorYizhuo <yzhai003@ucr.edu>
Mon, 26 Aug 2019 23:55:28 +0000 (20:55 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 29 Aug 2019 13:22:39 +0000 (10:22 -0300)
Inside function ctrl_cx2341x_getv4lflags(), qctrl.flag
will be uninitlaized if cx2341x_ctrl_query() returns -EINVAL.
However, it will be used in the later if statement, which is
potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/pvrusb2/pvrusb2-hdw.c

index 2a946cff84b7dacc7c7b08cbfe30a21bd0bd3ab5..1cfb7cf64131aa652f09f79b31a05b591aa3a9ad 100644 (file)
@@ -784,7 +784,7 @@ static int ctrl_cx2341x_set(struct pvr2_ctrl *cptr,int m,int v)
 
 static unsigned int ctrl_cx2341x_getv4lflags(struct pvr2_ctrl *cptr)
 {
-       struct v4l2_queryctrl qctrl;
+       struct v4l2_queryctrl qctrl = {};
        struct pvr2_ctl_info *info;
        qctrl.id = cptr->info->v4l_id;
        cx2341x_ctrl_query(&cptr->hdw->enc_ctl_state,&qctrl);