From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: SebinSebastian <mailmesebin00@gmail.com>
Cc: Neal Liu <neal_liu@aspeedtech.com>,
Felipe Balbi <balbi@kernel.org>, Joel Stanley <joel@jms.id.au>,
Andrew Jeffery <andrew@aj.id.au>,
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
Date: Wed, 29 Jun 2022 10:24:07 +0200 [thread overview]
Message-ID: <YrwMJ+3mdFO2Lpm0@kroah.com> (raw)
In-Reply-To: <20220629080726.107297-1-mailmesebin00@gmail.com>
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 <mailmesebin00@gmail.com>
> ---
> 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-29 8:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 8:07 [PATCH -next] usb: gadget: dereference before null check SebinSebastian
2022-06-29 8:24 ` Greg Kroah-Hartman [this message]
2022-06-29 12:14 ` Sebin Sebastian
2022-06-29 15:31 ` Greg Kroah-Hartman
2022-06-30 3:51 ` Sebin Sebastian
2022-06-29 17:56 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YrwMJ+3mdFO2Lpm0@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=andrew@aj.id.au \
--cc=balbi@kernel.org \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mailmesebin00@gmail.com \
--cc=neal_liu@aspeedtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).