Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp935898ybk; Fri, 15 May 2020 18:19:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXHKQ4LE7spX2azTLFz+mOdNseEWmtW7uTI6qzhDn+cXIqXA7HiWK/EPp4shvs3stlAjzW X-Received: by 2002:a50:e711:: with SMTP id a17mr5385738edn.369.1589591948449; Fri, 15 May 2020 18:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589591948; cv=none; d=google.com; s=arc-20160816; b=MS/9fmcJxoouFzyZOnlCSK8+Vl9o3J7SjrTZj6e+oV/G427Qiy4qeC490oTd5rQ3Xi CmudPjV6JB9jvd414IxDBB+j+WcozkT5E2giNG7UO57+2XyHHdBJPAkHQEjfqdSHuqpE aj51MCDAyojA34czEMYuOPieBoWafipOFdrh8eNTaQyhEKwXdwy0Cg8VRboBRX8akrRJ BxpgVToZxCQ+0AFkKG4FsNKFpCpsyFMe3PW6hm6jVuPP1NSuoaxuD7EBlg6mTK9j9VbW GnH2DqedECYE3hUSSc0YmYrC1FglpgCMxkjeBkrDNOpU0zgNOXsNU8YoPF/m6eNNr0xc qi4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/89pK826SSynYELsD8CFX/SkBK6egwQ7WtLJWVjNpj8=; b=Tu3ETvoWcZmoYn8oRTFCdXEDcOEYBZwpYa+MSt3dViaWE83v/P1Br6hIT65pQIpb7J AIZBPRCxJTNoj7exdNGTSklJyJ2vpzB8YaqMJX1lvjmzb2KvA8fLV/fHnAgczJ41aZ8A TLsYQ2nsYPbUG7s0fGkDHo5OUdT0NCt9+1IhslAyZeidT6jNflUi61Iiw1qKL+XizOc4 Fj56ErjE6eeUz3WqdLEh13ChbofC1Y59Dxa2prI4IpkJuviHPujsN6aiSp14PfRTAegj 9oymm3/ABv1IKWxUEMwkRpvzuFPQw36QflXId0e3xhdiayCjIi07HLqnAy5rne+AfW6S wiXg== 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 l35si2140717ede.136.2020.05.15.18.18.42; Fri, 15 May 2020 18:19:08 -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 S1726231AbgEPBRN (ORCPT + 99 others); Fri, 15 May 2020 21:17:13 -0400 Received: from netrider.rowland.org ([192.131.102.5]:47113 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726204AbgEPBRM (ORCPT ); Fri, 15 May 2020 21:17:12 -0400 Received: (qmail 14004 invoked by uid 500); 15 May 2020 21:17:11 -0400 Date: Fri, 15 May 2020 21:17:11 -0400 From: Alan Stern To: Tang Bin Cc: Colin King , Greg Kroah-Hartman , Zhang Shengju , linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparisonof an unsigned int Message-ID: <20200516011711.GA13833@rowland.harvard.edu> References: <20200515165453.104028-1-colin.king@canonical.com> <20200515172121.GA5498@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 16, 2020 at 07:23:42AM +0800, Tang Bin wrote: > Hi Alan & Colin: > > On 2020/5/16 1:21, Alan Stern wrote: > > On Fri, May 15, 2020 at 05:54:53PM +0100, Colin King wrote: > > > From: Colin Ian King > > > > > > The comparison of hcd->irq to less than zero for an error check will > > > never be true because hcd->irq is an unsigned int. Fix this by > > > assigning the int retval to the return of platform_get_irq and checking > > > this for the -ve error condition and assigning hcd->irq to retval. > > > > > > Addresses-Coverity: ("Unsigned compared against 0") > > > Fixes: c856b4b0fdb5 ("USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()") > > > Signed-off-by: Colin Ian King > > > --- > > Thanks to Coverity for spotting this. Any reason why it didn't spot > > exactly the same mistake in the ohci-da8xx.c driver? > > I just looked at the code and wondered whether it would be more appropriate > to modify the header file "hcd.h".  Since 'irq' might be an negative, why > not just modify the variables in the 'struct usb_hcd',  'unsigned int  > irq'--> 'int irq'? After all, it's a public one. I think the code in the drivers should be changed. The reason is if platform_get_irq() returns a negative value, then that value should be what the probe function returns. Alan Stern