Blob Blame History Raw
From 0b5c47c64b6fb3b626c5f75d9dc36bc864907fca Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Wed, 7 Sep 2016 22:16:20 +0200
Subject: [PATCH 6/9] Prevent static code analyzer confusion

As reported in bug #48723:
http://savannah.nongnu.org/bugs/?48723

This is a false positive and the static code analyzer output should
be made clearer. Nevertheless we can write the code differently so
that it doesn't trigger a warning.
---
 dmidecode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dmidecode.c b/dmidecode.c
index f929b28..3993592 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -2283,7 +2283,7 @@ static void dmi_memory_device_extended_size(u32 code)
	 */
	if (code & 0x3FFUL)
		printf(" %lu MB", (unsigned long)code);
-	else if (code & 0xFFFFFUL)
+	else if (code & 0xFFC00UL)
		printf(" %lu GB", (unsigned long)code >> 10);
	else
		printf(" %lu TB", (unsigned long)code >> 20);
--
2.10.2