Received: by 2002:a17:90a:b81:0:0:0:0 with SMTP id 1csp4999207pjr; Mon, 26 Aug 2019 16:33:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcl8/YTP5Nn1E4h0kXBABYrLGOj3hjLL5BqZz4pMVqXDX8NnPubB9AjH0u09sMOBkQSESu X-Received: by 2002:a17:902:8492:: with SMTP id c18mr21910165plo.279.1566862389445; Mon, 26 Aug 2019 16:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566862389; cv=none; d=google.com; s=arc-20160816; b=j55kuIYveCKaL67XpwdFCGK2XnwhNXC1jcpWDJyVWwp7hbZ+RMJ28IhEK+J0lliw/l AwB083ydTMgjuF5zvNkCPmOqFe8JgrfzfLHRKwdN1KgDcI/hh3XfAJY0dlqq4mwgeoTH 5QY80c+CWwoP7148t/eFTLGuozbWyU+HvZrcXHxlV4wBHdBsKb6zoHtxulkNXCKpvxN1 MexZ6WlWw4aZIzIepA4Rue0SVuMmUFP28DzPbTvs5uJyYKAwORrxkWqSJXRILsVR89os jEZHPPO4SoZK2nnNYQR9jqo6P8qNa3TlUD+MYNdWbu7z0wytOGbUxUX7PtPZGOg3rHzb QunQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:ironport-phdr:ironport-sdr :dkim-signature; bh=zHZ68SOgALOLBcJLTVPjnAnpRGohAVYDLu1/pi6HRkU=; b=dvNsBdsJCMHsjMOnsLsbmDE8zVOWCOOe3LgP4/3V3bBEG6deO7+SlZUTjynrQPTUh+ g92G+eBzAMmHkiAhqeMDricfDI9TkgPqXSnuvtc9jGPwXPKiJDjHW0PmLsR+h0bao93Q A7wTSvbDaOh5VCmlDdz/ZdurbyAIwNHRDE1kFYikfcIvIAp0JIiWEJ9fZGUx4PmcrEPw iTRryfCh8NMyRdw/dnoy+hXm9x7K5k2LF6k76r6qvFjj+H7IYvKaDpY1yXi+crOluc6i nhSKrqG5UrK/uVwIBuPn1d3WLYGKege0iT720fwxt4Lj2LqLE+T5tvzSgtVPSaEgDWjj ZJmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ucr.edu header.s=selector3 header.b=p8tjgyT0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucr.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f196si11995038pfa.57.2019.08.26.16.32.48; Mon, 26 Aug 2019 16:33:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ucr.edu header.s=selector3 header.b=p8tjgyT0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucr.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726616AbfHZXbx (ORCPT + 99 others); Mon, 26 Aug 2019 19:31:53 -0400 Received: from mx2.ucr.edu ([138.23.62.3]:31527 "EHLO mx2.ucr.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726278AbfHZXbx (ORCPT ); Mon, 26 Aug 2019 19:31:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ucr.edu; i=@ucr.edu; q=dns/txt; s=selector3; t=1566862312; x=1598398312; h=mime-version:references:in-reply-to:from:date:message-id: subject:to:cc; bh=kM9Cua1Vg8/QCuVf7JXsyJ3DROfw4JpvuudbKKgV8nw=; b=p8tjgyT0lz06lcVIToZ0mdcX/2ueafffnYZGyT+OieParPuAwMB5IKFw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SMy/XrJgcJskq1UvBOhpwR+w4HKZoGVKOF+db7Zcd8DWG?= =?us-ascii?q?ZNQtpdWylHD4ihbYUAEvABMP5XoInzpVQArRWwCwqxCu3x1jBFnWP20bEg3u?= =?us-ascii?q?g9DQ3KwA4tEtQTu3rUttX1M6ISXPi3w6nJzDTDb+5W2TDg44fLchAuu/CMVq?= =?us-ascii?q?93fMvRyEgvFxnKjlSMpYD5MT6YzfkNvHSB7+Z6S+2glnMnphh3rzOyxckskp?= =?us-ascii?q?HEipwJxl3A7yl0w4Y4KcelREN6Y9OoCplduzycOoBrWM0tWXtotzw/yrAevJ?= =?us-ascii?q?67ezUFx4o/yh7EbvyHb5CI4hX+VOaNOTt4hGxqeLa4hxuq9Eiv0Oz8Vs2t3F?= =?us-ascii?q?ZOoCpJj8DAtn4P2hDO8MSHRfx9/kCu2TaLyQ/f8P1LIUcxlabDKp4hxKA/lo?= =?us-ascii?q?YLvEjdAiP7nF/6gayWe0k+5+Sl6ubqbq/kq5OBL4N0jxvxMqUqmsyxG+Q4NQ?= =?us-ascii?q?0OUnCb+OW91L3s50z5TKlWgvA4iaTZrYzVJd4BqqGnHgBVz54v6wyjADe+zN?= =?us-ascii?q?QYgX4HIUpBeBKGiYjpJl7PLOn7DfihmVSslilkx/TdM73/DZXCMGLDnK3ifb?= =?us-ascii?q?lj8U5czhQ8zdRF65JTELEBL6G7ZkiklNXeFVcHPha33ufjQIF9yI4EWn+OBo?= =?us-ascii?q?eJK//btVvO4OZ5cMeWY4pAiTfvK+Uir8zuhH5xzU4PfaCohcNMQG2zBLJrL1?= =?us-ascii?q?jPMimkucsIDWpf5ll2d+ftklDXFGcLP3s=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2G3CwA3a2RdgEenVdFlHgEGBwaBZ4J?= =?us-ascii?q?ARYEFKoQhg0qLPoIPgjKRQIFkhTsBCAEBAQ4bFAEBgQSDOwKCaCM4EwIKAQE?= =?us-ascii?q?FAQEBAQEGBAEBAhABAQkNCQgnhTYMgjopAYFLXz4BAQEDEhEEUhALCwMKAgI?= =?us-ascii?q?fBwICIhIBBQEcBhMIGoMBggqeJ4EDPIskfzODd4RoAQgMgUkSeiiLcoIXg24?= =?us-ascii?q?1PoJIhQeCWASBLgEBAZQ/lXkBBgIBggwUhmqFNIglG4IybYZDjm0thAWdaoQ?= =?us-ascii?q?LDyGBRoF6MxolfwZngU4JgnGGBIgpIjCPVAEB?= X-IPAS-Result: =?us-ascii?q?A2G3CwA3a2RdgEenVdFlHgEGBwaBZ4JARYEFKoQhg0qLP?= =?us-ascii?q?oIPgjKRQIFkhTsBCAEBAQ4bFAEBgQSDOwKCaCM4EwIKAQEFAQEBAQEGBAEBA?= =?us-ascii?q?hABAQkNCQgnhTYMgjopAYFLXz4BAQEDEhEEUhALCwMKAgIfBwICIhIBBQEcB?= =?us-ascii?q?hMIGoMBggqeJ4EDPIskfzODd4RoAQgMgUkSeiiLcoIXg241PoJIhQeCWASBL?= =?us-ascii?q?gEBAZQ/lXkBBgIBggwUhmqFNIglG4IybYZDjm0thAWdaoQLDyGBRoF6Mxolf?= =?us-ascii?q?wZngU4JgnGGBIgpIjCPVAEB?= X-IronPort-AV: E=Sophos;i="5.64,435,1559545200"; d="scan'208";a="4537177" Received: from mail-lf1-f71.google.com ([209.85.167.71]) by smtp2.ucr.edu with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2019 16:31:49 -0700 Received: by mail-lf1-f71.google.com with SMTP id y24so2877170lfh.5 for ; Mon, 26 Aug 2019 16:31:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zHZ68SOgALOLBcJLTVPjnAnpRGohAVYDLu1/pi6HRkU=; b=JNynOGB1DVNm9biWt323QVNMaMiOqdtQ4F8dNqH1rLBXM3j01D0QDdKsKdoQ/EODsr 8gPiabsdLhzDJTm8R6CalrkPAGCvk1JiPFfWmzRWkHm0YSPYgA8ecaVYCpfuomeh9SmK eDGfc7krjvNIS3YLbzdwFF3KmfjvKV1ZknKuQnEziKqWzG4rO4HBCQKSvxtRRjQUFK2s py7Fqw0bRFtIFDD9Ux3nw8tgPpCFrfRJ5Gt9V8OTlZXljwm6OHxMAZjb+L09PVCzb7fI ztljI9LXwfu5eno8gwd6cD2iCiBRsEwZHuEI5RYksb5SDhg/6JfCEtTMnBQ1eh8Nt1Zf f2RA== X-Gm-Message-State: APjAAAWe5tshCogRiwWFJE9idGOricC6vbIdT5EqIpJCuweTCQdP84Gv 7q3aLU7owcc6T8fDcJMF5V0ovoY0DuEjvKYEv/C9IyIyXIU26Gxvni1h/kzUHdUqI26hgD6SKZQ GIr3DH1wC4tQBZvCXc1SAnvjGQoqBpYyGwLDuqKC9Mw== X-Received: by 2002:a2e:b4db:: with SMTP id r27mr12031851ljm.110.1566862308155; Mon, 26 Aug 2019 16:31:48 -0700 (PDT) X-Received: by 2002:a2e:b4db:: with SMTP id r27mr12031844ljm.110.1566862307961; Mon, 26 Aug 2019 16:31:47 -0700 (PDT) MIME-Version: 1.0 References: <20190821210931.9621-1-yzhai003@ucr.edu> In-Reply-To: From: Yizhuo Zhai Date: Mon, 26 Aug 2019 16:32:17 -0700 Message-ID: Subject: Re: [PATCH] [media] pvrusb2: qctrl.flag will be uninitlaized if cx2341x_ctrl_query() returns error code To: Hans Verkuil Cc: Chengyu Song , Zhiyun Qian , Mike Isely , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for the correction, let me send a new patch then. On Mon, Aug 26, 2019 at 5:09 AM Hans Verkuil wrote: > > On 8/21/19 11:09 PM, Yizhuo wrote: > > 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 > > --- > > drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > > index ad5b25b89699..1fa05971316a 100644 > > --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > > +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > > @@ -793,6 +793,7 @@ static unsigned int ctrl_cx2341x_getv4lflags(struct pvr2_ctrl *cptr) > > struct v4l2_queryctrl qctrl; > > struct pvr2_ctl_info *info; > > qctrl.id = cptr->info->v4l_id; > > + memset(&qctr, 0, sizeof(qctrl)) > > Please compile test your patches! This doesn't compile due to a typo > (qctr -> qctrl). > > Also, this would overwrite qctrl.id with 0, not what you want. > > Instead, just do: > > struct v4l2_queryctrl qctrl = {}; > > to initialize the struct with all 0. > > Regards, > > Hans > > > cx2341x_ctrl_query(&cptr->hdw->enc_ctl_state,&qctrl); > > /* Strip out the const so we can adjust a function pointer. It's > > OK to do this here because we know this is a dynamically created > > > -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside