From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Ellerman Subject: Re: [PATCH 2/2] kvm tools: Check for unknown parameters in network option handling Date: Mon, 13 Aug 2012 13:31:59 +1000 Message-ID: <1344828719.7376.1.camel@concordia> References: <1344577132-19796-1-git-send-email-michael@ellerman.id.au> <1344577132-19796-2-git-send-email-michael@ellerman.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: penberg@kernel.org, kvm@vger.kernel.org To: Asias He Return-path: Received: from ozlabs.org ([203.10.76.45]:45713 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753020Ab2HMDb5 (ORCPT ); Sun, 12 Aug 2012 23:31:57 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Sat, 2012-08-11 at 08:21 +0800, Asias He wrote: > On Fri, Aug 10, 2012 at 1:38 PM, Michael Ellerman > wrote: > > Currently the parsing of network command line parameters doesn't check > > for unknown parameters. > > > > For example "-n mod=none" will cause kvmtool to setup TAP networking. > > > > Save users from their typos by checking for unknown parameters and bailing. > > > > Signed-off-by: Michael Ellerman > > --- > > tools/kvm/builtin-run.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c > > index a36bd00..9e5c1d4 100644 > > --- a/tools/kvm/builtin-run.c > > +++ b/tools/kvm/builtin-run.c > > @@ -257,7 +257,8 @@ static int set_net_param(struct virtio_net_params *p, const char *param, > > p->vhost = atoi(val); > > } else if (strcmp(param, "fd") == 0) { > > p->fd = atoi(val); > > - } > > + } else > > + die("Unknown network parameter %s", param); > > we need braces here: We don't _need_ braces, but I assume you mean you'd prefer braces? cheers