Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3489618ybt; Tue, 23 Jun 2020 03:41:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/HJceKTcu+4puF/myNUmZl85RB38bT/Ft64jtnQUMeP1t5DVbF4nCbZFChtY8mLeD+Rfj X-Received: by 2002:a17:907:40c7:: with SMTP id nv7mr19222544ejb.316.1592908892194; Tue, 23 Jun 2020 03:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592908892; cv=none; d=google.com; s=arc-20160816; b=VWC3pbckqLFw8H7wXmsBjFntfGvKeBlX9jcxYxaabP2juq1rULtzQwvADiBqDnPObT ZLW/EkY9YYvVqg6BnOT4XHCVl1OJ2OipOItZfW+ZtBovEcOb/ItKWCO3vjtwEak37Jrr mwakFoDKyXyczzvAnu0rFaxv35FXwJkt+gTydxijdgwMR2BZ/Xahr9VlOhhr8IjztiL0 GUUyIW/xDSNCvZ69M6WSMbBZ8RgxzmCE49mHagksuuFHBD3vzBgnCOYRrq1frZszRrfv tg2+jo/ZCeIkk5mPK+fopyYJ4cR41s08sOyvjO+ZMKBAAjAhVu9c61SCtgjl5Yqc6Lfd Au0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=n5XuAR9+O0ifIvp3nJRV9lwMwdmcqKft/1latpOpeYQ=; b=vcl39ZTMNvVKfZ52WYf703AsgiZ2nvR6uzluD6Xp1uZhpI+tSU4XgyFblrBXee3A/2 Q3prGZX/TS1kA/1f/nGGkUU0VQAuZ08//X9pRuiN2ocXD41yMOKrU94KaK3nSnX4Opxo l4vYRrPX0vHFsm52msIE/lB1jPvIdErrmTIvyJ466PVvBQArYsFWCiZZ/jIJHWcMhrB3 yiHA3jtYywA0E7i9iFS7Thfy1XdEUn8YHp5YPBylsMqrhSHannMtWBHzYIZgosTezdaT mkmNp4+2E2rWNQKdWBrXPeD/S4yW0X0vKCmUCHu899Gu2OT++WuZq0N5Eu/Wxy7aLABR j1yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=LPrLU7KO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h18si894177ejd.91.2020.06.23.03.41.08; Tue, 23 Jun 2020 03:41:32 -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; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=LPrLU7KO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732248AbgFWKjJ (ORCPT + 99 others); Tue, 23 Jun 2020 06:39:09 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:58944 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732224AbgFWKjI (ORCPT ); Tue, 23 Jun 2020 06:39:08 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05NAc0Rb070633; Tue, 23 Jun 2020 10:39:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=n5XuAR9+O0ifIvp3nJRV9lwMwdmcqKft/1latpOpeYQ=; b=LPrLU7KO0gkf8k23PUy0TAS0eZYp+yxfHXBAjkajr7TXfhheo7k/y9bKFyTr72LOP27z qMwGSRjqavkOUpC2cZARjsWWlN/4uP5fbIE2I0J0ThuRlx0YsVsVf1QYCaDyrg4fMcOR 2SmPrY/4Rav17QntGS4MifdDCcex1XlfVggOEDf7qQ2wqN1Hwfd4iOJFgeP2mhdzqMef 2juKPhaDLe9NuYYAIsVTqp1tutooQ9mlWf3Siu6CNpFlebpI+/YVtIsy6PfpE12R0lTD gnpZZjJh0cuFofpTUabw3L6WHbyd3z2x0C8ICmOgRQ3N7Np4vYJ2Juzi4WVhkzk6iOq+ Iw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 31sebbcgfm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jun 2020 10:39:01 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05NAS8CW154650; Tue, 23 Jun 2020 10:37:00 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 31sv7rkm22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jun 2020 10:37:00 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05NAaw2K028133; Tue, 23 Jun 2020 10:36:59 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 23 Jun 2020 10:36:57 +0000 Date: Tue, 23 Jun 2020 13:36:51 +0300 From: Dan Carpenter To: Ran Wang Cc: "kbuild@lists.01.org" , "lkp@intel.com" , "kbuild-all@lists.01.org" , "linux-kernel@vger.kernel.org" , Felipe Balbi , Peter Chen Subject: Re: [kbuild] drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we previously assumed '_ep->desc' could be null (see line 1055) Message-ID: <20200623103651.GZ4282@kadam> References: <20200622182023.GX4282@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9660 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006230083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9660 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 cotscore=-2147483648 lowpriorityscore=0 phishscore=0 bulkscore=0 clxscore=1015 impostorscore=0 malwarescore=0 priorityscore=1501 spamscore=0 mlxscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006230084 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 02:22:18AM +0000, Ran Wang wrote: > Hi Dan > > On Tuesday, June 23, 2020 2:20 AM, Dan Carpenter wrote: > > > > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot > > Reported-by: Dan Carpenter > > > > New smatch warnings: > > drivers/usb/gadget/udc/fsl_udc_core.c:1055 fsl_ep_fifo_status() error: we > > previously assumed '_ep->desc' could be null (see line 1055) > > > > > > > > > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c Anatolij Gustschin > > 2011-04-18 1047 static int fsl_ep_fifo_status(struct usb_ep *_ep) > > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c Anatolij Gustschin > > 2011-04-18 1048 { > > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c Anatolij Gustschin > > 2011-04-18 1049 struct fsl_ep *ep; > > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c Anatolij Gustschin > > 2011-04-18 1050 struct fsl_udc *udc; > > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c Anatolij Gustschin > > 2011-04-18 1051 int size = 0; > > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c Anatolij Gustschin > > 2011-04-18 1052 u32 bitmask; > > 6414e94c203d92 drivers/usb/gadget/fsl_udc_core.c Li Yang > > 2011-11-23 1053 struct ep_queue_head *qh; > > 2ea6698d7b9266 drivers/usb/gadget/fsl_udc_core.c Anatolij Gustschin > > 2011-04-18 1054 > > 75eaa498c99eeb drivers/usb/gadget/udc/fsl_udc_core.c Nikhil Badola > > 2019-10-21 @1055 if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF)) > > ^^^^^^^^^ Reversed NULL test. This will always return -ENODEV. (Or possibly crash. But I suspect it always returns -ENODEV instead of crashing). > > So the kernel test reports warning in case of '_ep->desc is null', right? > > My understanding is that this judgement would return -ENODEV when > executing '... || _ep-desc ||..' and never execute '_ep->desc->bEndpointAddress' part, > so crash would not happen, am I right? Yeah. I can't imagine how _ep->desc is NULL. It gets set to non-NULL in fsl_ep_enable() and then set to NULL in fsl_ep_disable(). regards, dan carpenter