From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyrill Gorcunov Subject: [PATCH] kvm tools: Use assert() helper to check a variable value Date: Mon, 19 Dec 2011 01:35:36 +0400 Message-ID: <20111218213536.GB17380@moon> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Sasha Levin , Asias He , Ingo Molnar , Thomas Gleixner , KVM-ML To: Pekka Enberg Return-path: Received: from mail-ee0-f46.google.com ([74.125.83.46]:49598 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751896Ab1LRVfk (ORCPT ); Sun, 18 Dec 2011 16:35:40 -0500 Received: by eekc4 with SMTP id c4so4886538eek.19 for ; Sun, 18 Dec 2011 13:35:39 -0800 (PST) Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: BUILD_BUG_ON is unable to catch errors on expression which can't be evaluated at compile time. Signed-off-by: Cyrill Gorcunov --- 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 +#include #include #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; }