From patchwork Thu Oct 13 17:45:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 4665 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 623DD23E0C for ; Thu, 13 Oct 2011 17:45:42 +0000 (UTC) Received: from mail-gx0-f180.google.com (mail-gx0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2C709A1868C for ; Thu, 13 Oct 2011 17:45:42 +0000 (UTC) Received: by ggni2 with SMTP id i2so390108ggn.11 for ; Thu, 13 Oct 2011 10:45:41 -0700 (PDT) Received: by 10.223.17.11 with SMTP id q11mr7518395faa.13.1318527941366; Thu, 13 Oct 2011 10:45:41 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.24.41 with SMTP id r9cs270323laf; Thu, 13 Oct 2011 10:45:41 -0700 (PDT) Received: by 10.216.140.223 with SMTP id e73mr197386wej.112.1318527940447; Thu, 13 Oct 2011 10:45:40 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id fi7si3577762wbb.145.2011.10.13.10.45.39 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Oct 2011 10:45:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1REPLd-0005qX-Vc; Thu, 13 Oct 2011 18:45:37 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH] compatfd.c: Don't pass NULL pointer to SYS_signalfd Date: Thu, 13 Oct 2011 18:45:37 +0100 Message-Id: <1318527937-22450-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 Don't pass a NULL pointer in to SYS_signalfd in qemu_signalfd_available(): this isn't valid and Valgrind complains about it. Signed-off-by: Peter Maydell Reviewed-by: Stefan Hajnoczi --- compatfd.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compatfd.c b/compatfd.c index 31654c6..02306a4 100644 --- a/compatfd.c +++ b/compatfd.c @@ -119,9 +119,17 @@ int qemu_signalfd(const sigset_t *mask) bool qemu_signalfd_available(void) { #ifdef CONFIG_SIGNALFD + sigset_t mask; + int fd; + bool ok; + sigemptyset(&mask); errno = 0; - syscall(SYS_signalfd, -1, NULL, _NSIG / 8); - return errno != ENOSYS; + fd = syscall(SYS_signalfd, -1, &mask, _NSIG / 8); + ok = (errno != ENOSYS); + if (fd >= 0) { + close(fd); + } + return ok; #else return false; #endif