mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + lib-mpi-fix-off-by-one-check-on-index-no.patch added to -mm tree
@ 2020-09-29 20:21 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-09-29 20:21 UTC (permalink / raw)
  To: colin.king, dhowells, herbert, longman, mm-commits, tianjia.zhang


The patch titled
     Subject: lib/mpi: fix off-by-one check on index "no"
has been added to the -mm tree.  Its filename is
     lib-mpi-fix-off-by-one-check-on-index-no.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/lib-mpi-fix-off-by-one-check-on-index-no.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/lib-mpi-fix-off-by-one-check-on-index-no.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Colin Ian King <colin.king@canonical.com>
Subject: lib/mpi: fix off-by-one check on index "no"

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")
Link: https://lkml.kernel.org/r/20200929131828.155691-1-colin.king@canonical.com
Fixes: a8ea8bdd9df9 ("lib/mpi: Extend the MPI library")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Waiman Long <longman@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/mpi/mpiutil.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/lib/mpi/mpiutil.c~lib-mpi-fix-off-by-one-check-on-index-no
+++ a/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");
_

Patches currently in -mm which might be from colin.king@canonical.com are

lib-mpi-fix-off-by-one-check-on-index-no.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-29 20:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 20:21 + lib-mpi-fix-off-by-one-check-on-index-no.patch added to -mm tree akpm

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).