+ lib-test_meminitc-minor-test-fixes.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: lib/test_meminit.c: minor test fixes
has been added to the -mm tree.  Its filename is
     lib-test_meminitc-minor-test-fixes.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/lib-test_meminitc-minor-test-fixes.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/lib-test_meminitc-minor-test-fixes.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: Alexander Potapenko <glider@xxxxxxxxxx>
Subject: lib/test_meminit.c: minor test fixes

Fix the following issues in test_meminit.c:
 - |size| in fill_with_garbage_skip() should be signed so that it
 doesn't overflow if it's not aligned on sizeof(*p);
 - fill_with_garbage_skip() should actually skip |skip| bytes;
 - do_kmem_cache_size() should deallocate memory in the RCU case.

Link: http://lkml.kernel.org/r/20190626133135.217355-1-glider@xxxxxxxxxx
Fixes: 7e659650cbda ("lib: introduce test_meminit module")
Fixes: 94e8988d91c7 ("lib/test_meminit.c: fix -Wmaybe-uninitialized false positive")
Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 lib/test_meminit.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/lib/test_meminit.c~lib-test_meminitc-minor-test-fixes
+++ a/lib/test_meminit.c
@@ -38,15 +38,14 @@ static int __init count_nonzero_bytes(vo
 }
 
 /* Fill a buffer with garbage, skipping |skip| first bytes. */
-static void __init fill_with_garbage_skip(void *ptr, size_t size, size_t skip)
+static void __init fill_with_garbage_skip(void *ptr, int size, size_t skip)
 {
-	unsigned int *p = (unsigned int *)ptr;
+	unsigned int *p = (unsigned int *)((char *)ptr + skip);
 	int i = 0;
 
-	if (skip) {
-		WARN_ON(skip > size);
-		p += skip;
-	}
+	WARN_ON(skip > size);
+	size -= skip;
+
 	while (size >= sizeof(*p)) {
 		p[i] = GARBAGE_INT;
 		i++;
@@ -227,6 +226,7 @@ static int __init do_kmem_cache_size(siz
 		if (buf_copy)
 			memcpy(buf_copy, buf, size);
 
+		kmem_cache_free(c, buf);
 		/*
 		 * Check that |buf| is intact after kmem_cache_free().
 		 * |want_zero| is false, because we wrote garbage to
_

Patches currently in -mm which might be from glider@xxxxxxxxxx are

mm-security-introduce-init_on_alloc=1-and-init_on_free=1-boot-options.patch
mm-init-report-memory-auto-initialization-features-at-boot-time.patch
lib-introduce-test_meminit-module.patch
lib-test_meminitc-minor-test-fixes.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux