+ bitops-introduce-the-for_each_set_clump8-macro-fix.patch added to -mm tree

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

 



The patch titled
     Subject: linux/bitmap.h: fix potential sign-extension overflow
has been added to the -mm tree.  Its filename is
     bitops-introduce-the-for_each_set_clump8-macro-fix.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/bitops-introduce-the-for_each_set_clump8-macro-fix.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/bitops-introduce-the-for_each_set_clump8-macro-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: "Gustavo A. R. Silva" <gustavo@xxxxxxxxxxxxxx>
Subject: linux/bitmap.h: fix potential sign-extension overflow

In expression 0xff << offset, left shifting by more than 31 bits has
undefined behavior.  Notice that the shift amount, *offset*, can be as
much as 63.

Fix this by adding suffix ULL to integer 0xFF.

Addresses Coverity 1487071 ("Bad bit shift operation")

Link: http://lkml.kernel.org/r/20191015184657.GA26541@embeddedor
Fixes: d33f5cbaadd8 ("bitops: introduce the for_each_set_clump8 macro")
Signed-off-by: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>
Cc: William Breathitt Gray <vilhelm.gray@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/linux/bitmap.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/bitmap.h~bitops-introduce-the-for_each_set_clump8-macro-fix
+++ a/include/linux/bitmap.h
@@ -520,7 +520,7 @@ static inline void bitmap_set_value8(uns
 	const size_t index = BIT_WORD(start);
 	const unsigned long offset = start % BITS_PER_LONG;
 
-	map[index] &= ~(0xFF << offset);
+	map[index] &= ~(0xFFULL << offset);
 	map[index] |= value << offset;
 }
 
_

Patches currently in -mm which might be from gustavo@xxxxxxxxxxxxxx are

bitops-introduce-the-for_each_set_clump8-macro-fix.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