linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Vincent Stehlé" <vincent.stehle@laposte.net>
Cc: devel@driverdev.osuosl.org, Rachel Kim <rachel.kim@atmel.com>,
	Dean Lee <dean.lee@atmel.com>, Chris Park <chris.park@atmel.com>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	linux-wireless@vger.kernel.org, Johnny Kim <johnny.kim@atmel.com>,
	linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH next] staging: wilc1000: avoid NULL pointer dereference on error
Date: Wed, 7 Oct 2015 09:23:58 +0300	[thread overview]
Message-ID: <20151007062358.GN7340@mwanda> (raw)
In-Reply-To: <1444194505-31080-1-git-send-email-vincent.stehle@laposte.net>

On Wed, Oct 07, 2015 at 07:08:25AM +0200, Vincent Stehlé wrote:
>  drivers/staging/wilc1000/host_interface.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 2cf82b2..2fe3023 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -6017,7 +6017,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
>  	pstrWFIDrv  = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL);
>  	if (!pstrWFIDrv) {
>  		result = -ENOMEM;
> -		goto _fail_timer_2;
> +		goto _fail_;

Fair enough.  I would have prefered a direct return, but his also works.

The error handling in this function is still very bad and nonsensical.
You have fixed the first goto but all the others are buggy as well.

if add_handler_in_list() fails we should "goto free_pstrWFIDrv" (except
the label name should have Hungarian notation or CamelCase).  Instead of
freeing the current code unlocks a lock which is not initialiazed and
frees some timers which are also not initialized.

TODO: wilc1000: fix error handling in host_int_init()

regards,
dan carpenter



      reply	other threads:[~2015-10-07  6:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-07  5:08 [PATCH next] staging: wilc1000: avoid NULL pointer dereference on error Vincent Stehlé
2015-10-07  6:23 ` Dan Carpenter [this message]

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=20151007062358.GN7340@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=chris.park@atmel.com \
    --cc=dean.lee@atmel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=johnny.kim@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=rachel.kim@atmel.com \
    --cc=vincent.stehle@laposte.net \
    /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).