Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1389743pxa; Thu, 20 Aug 2020 10:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvTwsL/EK1q/2O3InZmOWqcMGKVMS+3yrRX+SaX/tQgstXaDVN8HoLo/9jADw1CVWnAFg+ X-Received: by 2002:aa7:dd05:: with SMTP id i5mr3945638edv.324.1597942916713; Thu, 20 Aug 2020 10:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597942916; cv=none; d=google.com; s=arc-20160816; b=Uzo3NnxV0ieg3KcYxF5C/7Jf594S3SDCBENBeBAEBOjaEe3abW8QaYvv7FJL8aMQko X1Jh1LWy9FNupyCGGG/auDot5tXMVU45TbDorym0v59hQ9pZMkFtF2sDOnpJY5r19P+K jP23iTxypCMer8w9aQVZWSYpNwheIUUa1Ucsbo2ZOXMZ7M8JHKnTV7V4FqVb0Y0QHvJV HakyaI/5H6GOtg+QwZPLgK0PFSSk4Qu75Lwfluw4lVmXhrkzMQ9l2hPwiUCQlnSvDAtu M4re9gK6gzwLUal/x+y5lw+x3tQCSL2mmDjwGoGQ81ZPODCZQZoG6el3K9EwpkekkeJw FjFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:message-id:in-reply-to:subject:cc:to:reply-to :from:date; bh=5ClXempYyIqNW7ELSZHu1HYqPAx5mygYlNqYCgAWliQ=; b=PIgb74Wk5+nMcffJ3JKbMbsdBKUPU3ZdabS5+b9rQKAgDubTuJWCYhXWepe/6XBpR6 TlQhrXMMIWbnsDM9021ZEgT5s6tv67KM26xVp4VLxyOVODLWRizxg2u8x8Fje7mznfYp 6UOwqJwLnpWluJeVHeifx71zFNjFReLXm2Hd2UAQ+195Vu0nkaFr+S5Fvv9AeyH0pBkH YeKBbnuN9y1TWbt+q3lv5o5nIE1LRzqusaHQcKdyNm6MjaSAnQHHnnSIgKdBEXWyyiJ5 BQSgmQGd7PVWWCIXR8yHNeEsnwDwlhA42B7wiV3tefHwumepA+k0mxF5xxK4GuAJlRsN i7Lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bv14si1575575ejb.249.2020.08.20.10.01.31; Thu, 20 Aug 2020 10:01:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728424AbgHTRAV (ORCPT + 99 others); Thu, 20 Aug 2020 13:00:21 -0400 Received: from cnc.isely.net ([75.149.91.89]:51183 "EHLO cnc.isely.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbgHTRAU (ORCPT ); Thu, 20 Aug 2020 13:00:20 -0400 X-Greylist: delayed 305 seconds by postgrey-1.27 at vger.kernel.org; Thu, 20 Aug 2020 13:00:20 EDT Received: from cnc-c.isely.net ([::ffff:75.149.91.89]) (AUTH: PLAIN isely, TLS: TLSv1/SSLv3,256bits,DHE-RSA-AES256-SHA) by cnc.isely.net with ESMTPSA; Thu, 20 Aug 2020 11:55:13 -0500 id 0000000000126070.000000005F3EAAF1.00001768 Date: Thu, 20 Aug 2020 11:55:13 -0500 (CDT) From: Mike Isely Reply-To: Mike Isely at pobox To: Tong Zhang cc: mchehab@kernel.org, linux-media@vger.kernel.org, Linux Kernel Mailing List , Hans Verkuil , Mike Isely at pobox Subject: Re: [PATCH v3] media: pvrusb2: fix parsing error In-Reply-To: <20200820165239.8510-1-ztong0001@gmail.com> Message-ID: References: <20200820165239.8510-1-ztong0001@gmail.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by: Mike Isely On Thu, 20 Aug 2020, Tong Zhang wrote: > pvr2_std_str_to_id() returns 0 on failure and 1 on success, > however the caller is checking failure case using <0 > > Co-developed-by: Hans Verkuil > Signed-off-by: Tong Zhang > --- > > v2: return -EINVAL as suggested by Hans Verkuil. > I also rebased the code on v5.9-rc1. > v3: remove unused variable > > drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > index 1cfb7cf64131..f4a727918e35 100644 > --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c > @@ -864,10 +864,9 @@ static int ctrl_std_sym_to_val(struct pvr2_ctrl *cptr, > const char *bufPtr,unsigned int bufSize, > int *mskp,int *valp) > { > - int ret; > v4l2_std_id id; > - ret = pvr2_std_str_to_id(&id,bufPtr,bufSize); > - if (ret < 0) return ret; > + if (!pvr2_std_str_to_id(&id, bufPtr, bufSize)) > + return -EINVAL; > if (mskp) *mskp = id; > if (valp) *valp = id; > return 0; > -- Mike Isely isely @ isely (dot) net PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8