From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VThre-0006Qf-Ie for qemu-devel@nongnu.org; Tue, 08 Oct 2013 20:43:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VThrS-0008QV-VZ for qemu-devel@nongnu.org; Tue, 08 Oct 2013 20:42:58 -0400 Received: from e24smtp04.br.ibm.com ([32.104.18.25]:40393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VThrS-0008Q1-Gt for qemu-devel@nongnu.org; Tue, 08 Oct 2013 20:42:46 -0400 Received: from /spool/local by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Oct 2013 21:42:45 -0300 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 5BEFA1DC0070 for ; Tue, 8 Oct 2013 20:42:41 -0400 (EDT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r990bLBY3137662 for ; Tue, 8 Oct 2013 21:37:21 -0300 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r990ges0006771 for ; Tue, 8 Oct 2013 21:42:40 -0300 From: Eduardo Otubo Date: Tue, 8 Oct 2013 21:42:26 -0300 Message-Id: <1381279346-23676-4-git-send-email-otubo@linux.vnet.ibm.com> In-Reply-To: <1381279346-23676-1-git-send-email-otubo@linux.vnet.ibm.com> References: <1381279346-23676-1-git-send-email-otubo@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCHv3 3/3] seccomp: general fixes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pmoore@redhat.com, coreyb@linux.vnet.ibm.com, anthony@codemonkey.ws, Eduardo Otubo 1) On qemu-seccomp.c:255, the variable ctx was being used uninitialized; now it's initialized with NULL and it's being checked at the end of the function. 2) Changed the name of the command line option from "enable" to "sandbox" for a better understanding from user side. Signed-off-by: Eduardo Otubo --- qemu-seccomp.c | 4 ++-- vl.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qemu-seccomp.c b/qemu-seccomp.c index 84a42bc..fdd0de3 100644 --- a/qemu-seccomp.c +++ b/qemu-seccomp.c @@ -258,7 +258,7 @@ seccomp_return: int seccomp_start(int list_type) { int rc = 0; - scmp_filter_ctx ctx; + scmp_filter_ctx ctx = NULL; switch (list_type) { case WHITELIST: @@ -285,7 +285,7 @@ int seccomp_start(int list_type) rc = seccomp_load(ctx); - seccomp_return: +seccomp_return: if (ctx) seccomp_release(ctx); return rc; diff --git a/vl.c b/vl.c index ffdf460..f5106e6 100644 --- a/vl.c +++ b/vl.c @@ -324,11 +324,11 @@ static QemuOptsList qemu_rtc_opts = { static QemuOptsList qemu_sandbox_opts = { .name = "sandbox", - .implied_opt_name = "enable", + .implied_opt_name = "sandbox", .head = QTAILQ_HEAD_INITIALIZER(qemu_sandbox_opts.head), .desc = { { - .name = "enable", + .name = "sandbox", .type = QEMU_OPT_BOOL, },{ .name = "strict", @@ -1037,7 +1037,7 @@ static int parse_sandbox(QemuOpts *opts, void *opaque) { const char *strict_value = NULL; /* FIXME: change this to true for 1.3 */ - if (qemu_opt_get_bool(opts, "enable", false)) { + if (qemu_opt_get_bool(opts, "sandbox", false)) { #ifdef CONFIG_SECCOMP if (seccomp_start(WHITELIST) < 0) { qerror_report(ERROR_CLASS_GENERIC_ERROR, -- 1.8.3.1