From: Colin King <colin.king@canonical.com> To: Andrew Morton <akpm@linux-foundation.org>, Johannes Weiner <hannes@cmpxchg.org>, Herbert Xu <herbert@gondor.apana.org.au>, Tianjia Zhang <tianjia.zhang@linux.alibaba.com>, Waiman Long <longman@redhat.com> Cc: kernel-janitors@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next][resend] lib/mpi: fix off-by-one check on index "no" Date: Wed, 30 Sep 2020 14:01:23 +0100 [thread overview] Message-ID: <20200930130123.8064-1-colin.king@canonical.com> (raw) From: Colin Ian King <colin.king@canonical.com> There is an off-by-one range check on the upper limit of index "no". Fix this by changing the > comparison to >= Addresses-Coverity: ("Out-of-bounds read") Fixes: a8ea8bdd9df9 ("lib/mpi: Extend the MPI library") Signed-off-by: Colin Ian King <colin.king@canonical.com> --- resend to Cc linux-crypto --- lib/mpi/mpiutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c index 3c63710c20c6..632d0a4bf93f 100644 --- a/lib/mpi/mpiutil.c +++ b/lib/mpi/mpiutil.c @@ -69,7 +69,7 @@ postcore_initcall(mpi_init); */ MPI mpi_const(enum gcry_mpi_constants no) { - if ((int)no < 0 || no > MPI_NUMBER_OF_CONSTANTS) + if ((int)no < 0 || no >= MPI_NUMBER_OF_CONSTANTS) pr_err("MPI: invalid mpi_const selector %d\n", no); if (!constants[no]) pr_err("MPI: MPI subsystem not initialized\n"); -- 2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: Colin King <colin.king@canonical.com> To: Andrew Morton <akpm@linux-foundation.org>, Johannes Weiner <hannes@cmpxchg.org>, Herbert Xu <herbert@gondor.apana.org.au>, Tianjia Zhang <tianjia.zhang@linux.alibaba.com>, Waiman Long <longman@redhat.com> Cc: kernel-janitors@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next][resend] lib/mpi: fix off-by-one check on index "no" Date: Wed, 30 Sep 2020 13:01:23 +0000 [thread overview] Message-ID: <20200930130123.8064-1-colin.king@canonical.com> (raw) From: Colin Ian King <colin.king@canonical.com> There is an off-by-one range check on the upper limit of index "no". Fix this by changing the > comparison to > Addresses-Coverity: ("Out-of-bounds read") Fixes: a8ea8bdd9df9 ("lib/mpi: Extend the MPI library") Signed-off-by: Colin Ian King <colin.king@canonical.com> --- resend to Cc linux-crypto --- lib/mpi/mpiutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c index 3c63710c20c6..632d0a4bf93f 100644 --- a/lib/mpi/mpiutil.c +++ b/lib/mpi/mpiutil.c @@ -69,7 +69,7 @@ postcore_initcall(mpi_init); */ MPI mpi_const(enum gcry_mpi_constants no) { - if ((int)no < 0 || no > MPI_NUMBER_OF_CONSTANTS) + if ((int)no < 0 || no >= MPI_NUMBER_OF_CONSTANTS) pr_err("MPI: invalid mpi_const selector %d\n", no); if (!constants[no]) pr_err("MPI: MPI subsystem not initialized\n"); -- 2.27.0
next reply other threads:[~2020-09-30 13:01 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-30 13:01 Colin King [this message] 2020-09-30 13:01 ` [PATCH][next][resend] lib/mpi: fix off-by-one check on index "no" Colin King 2020-09-30 14:35 ` Ondrej Mosnáček 2020-09-30 14:35 ` Ondrej Mosnáček 2020-09-30 16:03 ` Ard Biesheuvel 2020-09-30 16:03 ` Ard Biesheuvel
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=20200930130123.8064-1-colin.king@canonical.com \ --to=colin.king@canonical.com \ --cc=akpm@linux-foundation.org \ --cc=hannes@cmpxchg.org \ --cc=herbert@gondor.apana.org.au \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-crypto@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=longman@redhat.com \ --cc=tianjia.zhang@linux.alibaba.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: linkBe 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.