mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + mm-selftests-for-exclusive-device-memory-fix.patch added to -mm tree
@ 2021-05-26 19:11 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-05-26 19:11 UTC (permalink / raw)
  To: apopple, colin.king, jgg, mm-commits, rcampbell


The patch titled
     Subject: mm: selftests: fix potential integer overflow on shift of a int
has been added to the -mm tree.  Its filename is
     mm-selftests-for-exclusive-device-memory-fix.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-selftests-for-exclusive-device-memory-fix.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-selftests-for-exclusive-device-memory-fix.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: mm: selftests: fix potential integer overflow on shift of a int

The left shift of the int mapped is evaluated using 32 bit arithmetic and
then assigned to an unsigned long.  In the case where mapped is 0x80000
when PAGE_SHIFT is 12 will lead to the upper bits being sign extended in
the unsigned long.  Larger values can lead to an int overflow.  Avoid this
by making mapped an unsigned long.

Addresses-Coverity: ("Uninitentional integer overflow")
Link: https://lkml.kernel.org/r/20210526170530.3766167-1-colin.king@canonical.com
Fixes: 8b2a105c3794 ("mm: selftests for exclusive device memory")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/test_hmm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/lib/test_hmm.c~mm-selftests-for-exclusive-device-memory-fix
+++ a/lib/test_hmm.c
@@ -733,7 +733,8 @@ static int dmirror_exclusive(struct dmir
 
 	mmap_read_lock(mm);
 	for (addr = start; addr < end; addr = next) {
-		int i, mapped;
+		unsigned long mapped;
+		int i;
 
 		if (end < addr + (ARRAY_SIZE(pages) << PAGE_SHIFT))
 			next = end;
_

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

scripts-spellingtxt-add-more-spellings-to-spellingtxt.patch
ocfs2-remove-redundant-assignment-to-pointer-queue.patch
mm-selftests-for-exclusive-device-memory-fix.patch


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

only message in thread, other threads:[~2021-05-26 19:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 19:11 + mm-selftests-for-exclusive-device-memory-fix.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).