[tip:kmemcheck] kmemcheck (bitfields): don't actually initialize the bitfield

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

 



Author:     Vegard Nossum <vegard.nossum@xxxxxxxxx>
AuthorDate: Thu, 26 Feb 2009 14:36:37 +0100
Commit:     Vegard Nossum <vegard.nossum@xxxxxxxxx>
CommitDate: Thu, 26 Feb 2009 14:36:37 +0100

kmemcheck (bitfields): don't actually initialize the bitfield

If we do a memset() on the bitfield, it will be cleared. What we
want is to mark it initialized, so do (only) that. This way, we
also don't change the behaviour of the code itself -- for example,
a cache constructor could decide to preserve a bitfield across
alloc/free, which would be bad for us, since we reset the actual
contents of the bitfield too. So fix that.

Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxx>


---
 include/linux/kmemcheck.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index d1237f0..54c053b 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -68,9 +68,9 @@ void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
 int kmemcheck_show_addr(unsigned long address);
 int kmemcheck_hide_addr(unsigned long address);
 
-#define kmemcheck_annotate_bitfield(field)		\
-	do {						\
-		memset(&(field), 0, sizeof(field));	\
+#define kmemcheck_annotate_bitfield(field)				\
+	do {								\
+		kmemcheck_mark_initialized(&(field), sizeof(field));	\
 	} while (0)
 #else
 #define kmemcheck_enabled 0
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux