Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp732790iog; Wed, 29 Jun 2022 09:06:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v3hdlPktngFHfJ8n//GV4Bqmo5JH51HXTMXjAY5/5lUGnZdgU5FtUvMXz6494vhP8GfEGJ X-Received: by 2002:a05:6a00:22d6:b0:525:74b3:d020 with SMTP id f22-20020a056a0022d600b0052574b3d020mr9615786pfj.80.1656518812438; Wed, 29 Jun 2022 09:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656518812; cv=none; d=google.com; s=arc-20160816; b=X/08EeAIAU5MuMr1J1A3Jbw9ah5msOMrBVQcVI+PbCeqaDZjh9DGh3moY4AQNhDGgu BSte3HGUpmfomrjWPzB0JvPIqlDb1nwT3rwjqMPQ7sTorG3DpHTGplyyNrNCpIOBnT2r EJahLmE6p1Ba5dMn5lc1tM5W91U5eeRabb4RSuA0YogpKvJ09xb/+q3LWP4cQbx66TSR FVrmaYgIugPikjKMw8keh8/eKxqwo3Kw8lhHsSlXnvSYdXmo12+TbCy4NbzaFzpVJKAy G594trejMzri2i7827tMVJ+zY9tGuVl31eEzxt5SSLjDmMl5N/VyQjPezkzFLoXzxar2 bCjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WV7JpIKzoPG6dmFaV6GP11hTIpVf/3fkVuHBl9kLhj4=; b=u7xyt8KFv5mAkvILNUKOxH/0pgGhcVwpvj/r1uv3QssGUcnMwjByRbX7glBbKKdsFe X53k22ZNyEfc9oO3er/J9LJOHwgi6kgo4adFue/v4NTaQgRUI5BiTrhxtpr5TN/BlAB3 8nAZVKciHR2Sk99zcJMgO5oTd2n+Qj+QsSPYTQLzu/Ilb+/NRKjRTVj0G6wltUOx2CcE cdh9zHbrMiIqqZgHUjUSZWcfg1+evVUMRih83lbcIre5fAR6dard+/FAFtWCVdUVttEx Kyj2v42MYLDq1LxC92AVt0t/nrK5lXAn3hfNJl1RC/RHf0xV6aEJvutPvXD3cmTLReZn detA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m4SjOqpF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a1709026b8200b0016a0529c312si22095350plk.142.2022.06.29.09.06.29; Wed, 29 Jun 2022 09:06:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m4SjOqpF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233173AbiF2PcL (ORCPT + 99 others); Wed, 29 Jun 2022 11:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231622AbiF2PcK (ORCPT ); Wed, 29 Jun 2022 11:32:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B3512CCA6; Wed, 29 Jun 2022 08:32:09 -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 ams.source.kernel.org (Postfix) with ESMTPS id CBFD0B81DDF; Wed, 29 Jun 2022 15:32:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FBC7C34114; Wed, 29 Jun 2022 15:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656516726; bh=C7giPN+qsPnR9juAKxwWkHDcLBswzBs0OgjSrpVwzJM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m4SjOqpF8ZT7iAgy0s1lC3NNsCXzJ8S9sUOuNZA92qEM8N9RMAmSBsGPTYBu+EfUB BSYHByKEldQ6oPwFq9X2oJCeS7TMof7aLFWv+B3rk7NNQwwCsVTNdcFTbpbcj2FnxG 1nPOMWngZjlptmzFRjVNQ9ENdZG5/nRHVZ/TCaWo= Date: Wed, 29 Jun 2022 17:31:57 +0200 From: Greg Kroah-Hartman To: Sebin Sebastian Cc: Neal Liu , Felipe Balbi , Joel Stanley , Andrew Jeffery , linux-aspeed@lists.ozlabs.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] usb: gadget: dereference before null check Message-ID: References: <20220629080726.107297-1-mailmesebin00@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 29, 2022 at 05:44:55PM +0530, Sebin Sebastian wrote: > On Wed, Jun 29, 2022 at 10:24:07AM +0200, Greg Kroah-Hartman wrote: > > On Wed, Jun 29, 2022 at 01:37:25PM +0530, SebinSebastian wrote: > > > Fix coverity warning dereferencing before null check. _ep and desc is > > > dereferenced on all paths until the check for null. Move the > > > initializations after the check for null. > > > Coverity issue: 1518209 > > > > > > Signed-off-by: SebinSebastian > > > --- > > > drivers/usb/gadget/udc/aspeed_udc.c | 9 +++++---- > > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c > > > index d75a4e070bf7..96f8193fca15 100644 > > > --- a/drivers/usb/gadget/udc/aspeed_udc.c > > > +++ b/drivers/usb/gadget/udc/aspeed_udc.c > > > @@ -341,10 +341,6 @@ static void ast_udc_stop_activity(struct ast_udc_dev *udc) > > > static int ast_udc_ep_enable(struct usb_ep *_ep, > > > const struct usb_endpoint_descriptor *desc) > > > { > > > - u16 maxpacket = usb_endpoint_maxp(desc); > > > - struct ast_udc_ep *ep = to_ast_ep(_ep); > > > - struct ast_udc_dev *udc = ep->udc; > > > - u8 epnum = usb_endpoint_num(desc); > > > unsigned long flags; > > > u32 ep_conf = 0; > > > u8 dir_in; > > > @@ -356,6 +352,11 @@ static int ast_udc_ep_enable(struct usb_ep *_ep, > > > return -EINVAL; > > > } > > > > > > + u16 maxpacket = usb_endpoint_maxp(desc); > > > + struct ast_udc_ep *ep = to_ast_ep(_ep); > > > + struct ast_udc_dev *udc = ep->udc; > > > + u8 epnum = usb_endpoint_num(desc); > > > + > > > if (!udc->driver) { > > > EP_DBG(ep, "bogus device state\n"); > > > return -ESHUTDOWN; > > > -- > > > 2.34.1 > > > > > > > Hi, > > > > This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him > > a patch that has triggered this response. He used to manually respond > > to these common problems, but in order to save his sanity (he kept > > writing the same thing over and over, yet to different people), I was > > created. Hopefully you will not take offence and will fix the problem > > in your patch and resubmit it so that it can be accepted into the Linux > > kernel tree. > > > > You are receiving this message because of the following common error(s) > > as indicated below: > > > > - Your patch breaks the build. > > > > - Your patch contains warnings and/or errors noticed by the > > scripts/checkpatch.pl tool. > > > > - This looks like a new version of a previously submitted patch, but you > > did not list below the --- line any changes from the previous version. > > Please read the section entitled "The canonical patch format" in the > > kernel file, Documentation/SubmittingPatches for what needs to be done > > here to properly describe this. > > > > If you wish to discuss this problem further, or you have questions about > > how to resolve this issue, please feel free to respond to this email and > > Greg will reply once he has dug out from the pending patches received > > from other developers. > > > > thanks, > > > > greg k-h's patch email bot > > I am sorry to keep on bothering with this incorrect patches. I am > running the checkpatch script everytime before I sent any patches. It is > not showing any warnings or errors. Is it because of my name that my > patches are getting rejected? I can see a space missing. Did you test build your patch? If not, why not? thanks, greg k-h