lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 12 Feb 2012 13:59:37 -0800
From:	Joe Perches <joe@...ches.com>
To:	Olof Johansson <olof@...om.net>, Tejun Heo <tj@...nel.org>
Cc:	x86@...nel.org, hpa@...or.com, mingo@...e.hu, tglx@...utronix.de,
	linux-kernel@...r.kernel.org, matt.fleming@...el.com,
	mjg@...hat.com
Subject: [PATCH] memblock: Make memblock_dbg macro safer

Allow this macro to be used in an if/else block.

Use do {} while (0) and pr_info. (perhaps this should be pr_debug)

Signed-off-by: Joe Perches <joe@...ches.com>
---
 include/linux/memblock.h |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index a6bb102..0584d13 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -43,8 +43,11 @@ struct memblock {
 extern struct memblock memblock;
 extern int memblock_debug;
 
-#define memblock_dbg(fmt, ...) \
-	if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define memblock_dbg(fmt, ...)					\
+do {								\
+	if (memblock_debug)					\
+		pr_info(fmt, ##__VA_ARGS__);			\
+} while (0)
 
 phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end,
 				phys_addr_t size, phys_addr_t align, int nid);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ