Received: from [140.186.70.92] (port=39271 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSPRQ-0001yb-7V for qemu-devel@nongnu.org; Sat, 26 Jun 2010 03:04:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OSPRP-0005RV-0f for qemu-devel@nongnu.org; Sat, 26 Jun 2010 03:04:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31947) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSPRO-0005RP-O8 for qemu-devel@nongnu.org; Sat, 26 Jun 2010 03:04:38 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5Q74cur005243 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 26 Jun 2010 03:04:38 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 05/19] Ensure that QEMU exits if drive_add parsing fails References: <1275921752-29420-1-git-send-email-berrange@redhat.com> <1275921752-29420-6-git-send-email-berrange@redhat.com> Date: Sat, 26 Jun 2010 09:04:36 +0200 In-Reply-To: <1275921752-29420-6-git-send-email-berrange@redhat.com> (Daniel P. Berrange's message of "Mon, 7 Jun 2010 15:42:18 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org "Daniel P. Berrange" writes: > The drive_add() method returns NULL if it failed to parse the > parameter values for any reason. All callers must check this > and exit if failure occurred. Annotate the method so that the > compiler validates this. Good move. Need more of that. > Signed-off-by: Daniel P. Berrange > --- > vl.c | 38 ++++++++++++++++++++++++++------------ > 1 files changed, 26 insertions(+), 12 deletions(-) > > diff --git a/vl.c b/vl.c > index 7121cd0..3d08a44 100644 > --- a/vl.c > +++ b/vl.c > @@ -654,6 +654,7 @@ static int bt_parse(const char *opt) > #define MTD_ALIAS "if=mtd" > #define SD_ALIAS "index=0,if=sd" > > +QEMU_WARN_UNUSED_RESULT > QemuOpts *drive_add(const char *file, const char *fmt, ...) The *declaration* needs QEMU_WARN_UNUSED_RESULT. Tacking it onto the definition only protects this compilation unit. [...]