From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D76B1C28B2B for ; Fri, 19 Aug 2022 08:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347529AbiHSIiL (ORCPT ); Fri, 19 Aug 2022 04:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347522AbiHSIhf (ORCPT ); Fri, 19 Aug 2022 04:37:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5D824963; Fri, 19 Aug 2022 01:36:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1AE1761736; Fri, 19 Aug 2022 08:36:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F19F9C433D6; Fri, 19 Aug 2022 08:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660898185; bh=37pTA/oFRMsALSTQ50ISevTazTRGybq+TCbIbtOvcrA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BpZwiSe9p3y0Om5R2ul7ilZ5MrO+dprUGIxtu0Vv8WCkI0OMx0u6H+2rDRKNT+P6j L910bdZXZ07GoRnvrcvioW9J1ET9UO9Tcb36kg+ZkU4W441DV//8vNiCHL7N2MuC3N o7U11RVI9Fy+QtslZwguShifYWf4jlMXWXrcq+YA= Date: Fri, 19 Aug 2022 10:36:22 +0200 From: Greg Kroah-Hartman To: Andrey Strachuk Cc: Peter Chen , Pawel Laszczak , Roger Quadros , Aswath Govindraju , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH v2] usb: cdns3: change place of NULL check in cdns3_gadget_ep_enable() Message-ID: References: <16589929667170@kroah.com> <20220728163014.247082-1-strochuk@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220728163014.247082-1-strochuk@ispras.ru> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Thu, Jul 28, 2022 at 07:30:14PM +0300, Andrey Strachuk wrote: > If 'ep' is NULL, result of ep_to_cdns3_ep(ep) is invalid and > priv_ep->cdns3_dev causes panic. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Signed-off-by: Andrey Strachuk > Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") > --- > drivers/usb/cdns3/cdns3-gadget.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) No information on what changed from v1 to v2 :( > > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c > index 5c15c48952a6..51de7457a3b8 100644 > --- a/drivers/usb/cdns3/cdns3-gadget.c > +++ b/drivers/usb/cdns3/cdns3-gadget.c > @@ -2284,11 +2284,14 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep, > int ret = 0; > int val; > > + if (!ep) > + return -EINVAL; How can ep ever be NULL at all? Why does this need to be checked? thanks, greg k-h