From patchwork Fri Aug 10 05:38:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 1304071 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4F8CF3FC66 for ; Fri, 10 Aug 2012 05:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753978Ab2HJFjV (ORCPT ); Fri, 10 Aug 2012 01:39:21 -0400 Received: from ozlabs.org ([203.10.76.45]:60666 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753926Ab2HJFjT (ORCPT ); Fri, 10 Aug 2012 01:39:19 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 7EE702C0099; Fri, 10 Aug 2012 15:39:18 +1000 (EST) From: Michael Ellerman To: Cc: Subject: [PATCH 2/2] kvm tools: Check for unknown parameters in network option handling Date: Fri, 10 Aug 2012 15:38:52 +1000 Message-Id: <1344577132-19796-2-git-send-email-michael@ellerman.id.au> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1344577132-19796-1-git-send-email-michael@ellerman.id.au> References: <1344577132-19796-1-git-send-email-michael@ellerman.id.au> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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); return 0; }