Re: [PATCH] kvm tools: Use assert() helper to check a variable value

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

 



On Mon, 19 Dec 2011, Cyrill Gorcunov wrote:
BUILD_BUG_ON is unable to catch errors on expression which
can't be evaluated at compile time.

Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
---
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);

We should use BUG_ON() like tools/perf does.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux