mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adarsh J <root@hackmaster.in>
To: Dmitry Kasatkin <dmitry.kasatkin@intel.com>,
	James Morris <jmorris@namei.org>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Mimi Zohar <zohar@us.ibm.com>,
	David Howells <dhowells@redhat.com>
Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, Adarsh J <root@hackmaster.in>
Subject: [PATCH 1/1] lib/mpi: Fixed erroneous check on return value of mpi_resize()
Date: Sat,  5 May 2012 07:21:07 +0530	[thread overview]
Message-ID: <1336182667-9784-1-git-send-email-root@hackmaster.in> (raw)

mpi_resize() returns -ENOMEM on error and 0 on success.

Signed-off-by: Adarsh J <root@hackmaster.in>
---
 lib/mpi/mpicoder.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
index f26b41f..9949b69 100644
--- a/lib/mpi/mpicoder.c
+++ b/lib/mpi/mpicoder.c
@@ -98,7 +98,7 @@ int mpi_fromstr(MPI val, const char *str)
 	nbytes = (nbits + 7) / 8;
 	nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB;
 	if (val->alloced < nlimbs)
-		if (!mpi_resize(val, nlimbs))
+		if (mpi_resize(val, nlimbs) < 0)
 			return -ENOMEM;
 	i = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB;
 	i %= BYTES_PER_MPI_LIMB;
-- 
1.7.9.5


             reply	other threads:[~2012-05-05  1:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-05  1:51 Adarsh J [this message]
2012-05-05  3:30 ` Tetsuo Handa
2012-05-07  1:26   ` James Morris
2012-05-07 13:20 ` Kasatkin, Dmitry

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=1336182667-9784-1-git-send-email-root@hackmaster.in \
    --to=root@hackmaster.in \
    --cc=dhowells@redhat.com \
    --cc=dmitry.kasatkin@intel.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=zohar@us.ibm.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

all inboxes | Powered by JetHome®