All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Desmond Yan <desmond.yan@broadcom.com>,
	Olof Johansson <olof@lixom.net>, James Hu <james.hu@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] misc: bcm-vk: Fix a couple error codes in probe()
Date: Wed, 03 Feb 2021 20:05:29 +0000	[thread overview]
Message-ID: <20210203200529.GH20820@kadam> (raw)
In-Reply-To: <55880105-a097-0268-de54-478d7dbae084@broadcom.com>

On Wed, Feb 03, 2021 at 11:15:35AM -0800, Scott Branden wrote:
> Thanks Dan,
> 
> On 2021-02-03 6:42 a.m., Dan Carpenter wrote:
> > These errors should return negative error codes instead of returning
> > success.
> Do you have a script running to report such issues or just manually reviewing
> to find such paths?

Yeah.  This is a new Smatch check.  The heuristic is this:

	<-- ret is not set within 3 lines of the goto
	goto label;  <-- we hit a goto


	return 0;  <-- success path right before the cleanup block

label:	<-- labels
	return ret;  <-- This return has to sometimes returns negatives

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Scott Branden <scott.branden@broadcom.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Desmond Yan <desmond.yan@broadcom.com>,
	Olof Johansson <olof@lixom.net>, James Hu <james.hu@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] misc: bcm-vk: Fix a couple error codes in probe()
Date: Wed, 3 Feb 2021 23:05:29 +0300	[thread overview]
Message-ID: <20210203200529.GH20820@kadam> (raw)
In-Reply-To: <55880105-a097-0268-de54-478d7dbae084@broadcom.com>

On Wed, Feb 03, 2021 at 11:15:35AM -0800, Scott Branden wrote:
> Thanks Dan,
> 
> On 2021-02-03 6:42 a.m., Dan Carpenter wrote:
> > These errors should return negative error codes instead of returning
> > success.
> Do you have a script running to report such issues or just manually reviewing
> to find such paths?

Yeah.  This is a new Smatch check.  The heuristic is this:

	<-- ret is not set within 3 lines of the goto
	goto label;  <-- we hit a goto


	return 0;  <-- success path right before the cleanup block

label:	<-- labels
	return ret;  <-- This return has to sometimes returns negatives

regards,
dan carpenter


  reply	other threads:[~2021-02-03 20:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 14:42 [PATCH] misc: bcm-vk: Fix a couple error codes in probe() Dan Carpenter
2021-02-03 14:42 ` Dan Carpenter
2021-02-03 19:15 ` Scott Branden
2021-02-03 19:15   ` Scott Branden
2021-02-03 20:05   ` Dan Carpenter [this message]
2021-02-03 20:05     ` Dan Carpenter

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=20210203200529.GH20820@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=desmond.yan@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.hu@broadcom.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=scott.branden@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.