+ mm-sparse-fix-align-without-power-of-2-in-sparse_buffer_alloc.patch added to -mm tree

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

 



The patch titled
     Subject: mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
has been added to the -mm tree.  Its filename is
     mm-sparse-fix-align-without-power-of-2-in-sparse_buffer_alloc.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-sparse-fix-align-without-power-of-2-in-sparse_buffer_alloc.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-sparse-fix-align-without-power-of-2-in-sparse_buffer_alloc.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: Lecopzer Chen <lecopzer.chen@xxxxxxxxxxxx>
Subject: mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()

The size argumnet passed into sparse_buffer_alloc() has already been
aligned with PAGE_SIZE or PMD_SIZE.

If the size after aligned is not power of 2 (e.g.  0x480000), the
PTR_ALIGN() will return wrong value.  Use roundup to round sparsemap_buf
up to next multiple of size.

Link: http://lkml.kernel.org/r/20190705114826.28586-1-lecopzer.chen@xxxxxxxxxxxx
Signed-off-by: Lecopzer Chen <lecopzer.chen@xxxxxxxxxxxx>
Signed-off-by: Mark-PK Tsai <Mark-PK.Tsai@xxxxxxxxxxxx>
Cc: YJ Chiang <yj.chiang@xxxxxxxxxxxx>
Cc: Lecopzer Chen <lecopzer.chen@xxxxxxxxxxxx>
Cc: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>
Cc: Oscar Salvador <osalvador@xxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Mike Rapoport <rppt@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/sparse.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/sparse.c~mm-sparse-fix-align-without-power-of-2-in-sparse_buffer_alloc
+++ a/mm/sparse.c
@@ -459,7 +459,7 @@ void * __meminit sparse_buffer_alloc(uns
 	void *ptr = NULL;
 
 	if (sparsemap_buf) {
-		ptr = PTR_ALIGN(sparsemap_buf, size);
+		ptr = (void *) roundup((unsigned long)sparsemap_buf, size);
 		if (ptr + size > sparsemap_buf_end)
 			ptr = NULL;
 		else {
_

Patches currently in -mm which might be from lecopzer.chen@xxxxxxxxxxxx are

mm-sparse-fix-memory-leak-of-sparsemap_buf-in-aliged-memory.patch
mm-sparse-fix-align-without-power-of-2-in-sparse_buffer_alloc.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