All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dmitry Kasatkin <dmitry.kasatkin@intel.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] mpi/mpi-mpow: NULL dereference on allocation failure
Date: Mon, 21 Nov 2011 17:00:35 +0000	[thread overview]
Message-ID: <4ECA83B3.6040000@bfs.de> (raw)
In-Reply-To: <20111121145056.GB19092@elgon.mountain>



Am 21.11.2011 15:50, schrieb Dan Carpenter:
> We can't call mpi_free() on the elements if the first kzalloc() fails.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/lib/mpi/mpi-mpow.c b/lib/mpi/mpi-mpow.c
> index 4cc7593..7328d0d 100644
> --- a/lib/mpi/mpi-mpow.c
> +++ b/lib/mpi/mpi-mpow.c
> @@ -73,7 +73,7 @@ int mpi_mulpowm(MPI res, MPI *basearray, MPI *exparray, MPI m)
>  
>  	G = kzalloc((1 << k) * sizeof *G, GFP_KERNEL);
>  	if (!G)
> -		goto nomem;
> +		goto err_out;
>  
>  	/* and calculate */
>  	tmp = mpi_alloc(mpi_get_nlimbs(m) + 1);
> @@ -129,5 +129,6 @@ nomem:
>  	for (i = 0; i < (1 << k); i++)
>  		mpi_free(G[i]);
>  	kfree(G);
> +err_out:
>  	return rc;
>  }

the patch is ok
but is there any reason *not* to use a more nice name that 'G'
something more descriptive perhaps ?

re,
 wh



WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dmitry Kasatkin <dmitry.kasatkin@intel.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] mpi/mpi-mpow: NULL dereference on allocation failure
Date: Mon, 21 Nov 2011 18:00:35 +0100	[thread overview]
Message-ID: <4ECA83B3.6040000@bfs.de> (raw)
In-Reply-To: <20111121145056.GB19092@elgon.mountain>



Am 21.11.2011 15:50, schrieb Dan Carpenter:
> We can't call mpi_free() on the elements if the first kzalloc() fails.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/lib/mpi/mpi-mpow.c b/lib/mpi/mpi-mpow.c
> index 4cc7593..7328d0d 100644
> --- a/lib/mpi/mpi-mpow.c
> +++ b/lib/mpi/mpi-mpow.c
> @@ -73,7 +73,7 @@ int mpi_mulpowm(MPI res, MPI *basearray, MPI *exparray, MPI m)
>  
>  	G = kzalloc((1 << k) * sizeof *G, GFP_KERNEL);
>  	if (!G)
> -		goto nomem;
> +		goto err_out;
>  
>  	/* and calculate */
>  	tmp = mpi_alloc(mpi_get_nlimbs(m) + 1);
> @@ -129,5 +129,6 @@ nomem:
>  	for (i = 0; i < (1 << k); i++)
>  		mpi_free(G[i]);
>  	kfree(G);
> +err_out:
>  	return rc;
>  }

the patch is ok
but is there any reason *not* to use a more nice name that 'G'
something more descriptive perhaps ?

re,
 wh



  parent reply	other threads:[~2011-11-21 17:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 14:50 [patch] mpi/mpi-mpow: NULL dereference on allocation failure Dan Carpenter
2011-11-21 14:50 ` Dan Carpenter
2011-11-21 15:18 ` Kasatkin, Dmitry
2011-11-21 15:18   ` Kasatkin, Dmitry
2011-11-21 17:00 ` walter harms [this message]
2011-11-21 17:00   ` walter harms

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=4ECA83B3.6040000@bfs.de \
    --to=wharms@bfs.de \
    --cc=dan.carpenter@oracle.com \
    --cc=dmitry.kasatkin@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.