From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: Sasha Levin <levinsasha928@gmail.com>,
Asias He <asias.hejun@gmail.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
KVM-ML <kvm@vger.kernel.org>
Subject: [PATCH] kvm tools: Use assert() helper to check a variable value
Date: Mon, 19 Dec 2011 01:35:36 +0400 [thread overview]
Message-ID: <20111218213536.GB17380@moon> (raw)
BUILD_BUG_ON is unable to catch errors on expression which
can't be evaluated at compile time.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
tools/kvm/x86/bios.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: linux-2.6.git/tools/kvm/x86/bios.c
===================================================================
--- linux-2.6.git.orig/tools/kvm/x86/bios.c
+++ linux-2.6.git/tools/kvm/x86/bios.c
@@ -5,6 +5,7 @@
#include "kvm/util.h"
#include <string.h>
+#include <assert.h>
#include <asm/e820.h>
#include "bios/bios-rom.h"
@@ -98,7 +99,7 @@ static void e820_setup(struct kvm *kvm)
};
}
- BUILD_BUG_ON(i > E820_X_MAX);
+ assert(i <= E820_X_MAX);
e820->nr_map = i;
}
next reply other threads:[~2011-12-18 21:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 21:35 Cyrill Gorcunov [this message]
2011-12-19 7:13 ` [PATCH] kvm tools: Use assert() helper to check a variable value Pekka Enberg
2011-12-19 7:57 ` Cyrill Gorcunov
2011-12-19 8:04 ` Ingo Molnar
2011-12-19 8:19 ` Pekka Enberg
2011-12-19 8:25 ` Cyrill Gorcunov
2011-12-19 8:48 ` Pekka Enberg
2011-12-19 10:40 ` Ingo Molnar
2011-12-19 10:49 ` Cyrill Gorcunov
2011-12-19 10:50 ` Ingo Molnar
2011-12-19 10:57 ` Pekka Enberg
2011-12-19 10:57 ` Cyrill Gorcunov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111218213536.GB17380@moon \
--to=gorcunov@gmail.com \
--cc=asias.hejun@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=penberg@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).