From nobody Tue Feb 10 03:45:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494594413749236.86998311578645; Fri, 12 May 2017 06:06:53 -0700 (PDT) Received: from localhost ([::1]:53713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9AHS-0008ID-Fo for importer@patchew.org; Fri, 12 May 2017 09:06:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d98LK-00043J-Dk for qemu-devel@nongnu.org; Fri, 12 May 2017 07:02:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d98LG-0006RU-Up for qemu-devel@nongnu.org; Fri, 12 May 2017 07:02:42 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:46446 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d98LG-0006QF-O9 for qemu-devel@nongnu.org; Fri, 12 May 2017 07:02:38 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 651E81A4A04; Fri, 12 May 2017 13:02:12 +0200 (CEST) Received: from rtrkw488-lin.domain.local (unknown [10.10.14.90]) by mail.rt-rk.com (Postfix) with ESMTPSA id 1777B1A49EF; Fri, 12 May 2017 13:02:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: =?UTF-8?q?Milo=C5=A1=20Stojanovi=C4=87?= To: qemu-devel@nongnu.org, riku.voipio@iki.fi Date: Fri, 12 May 2017 13:02:20 +0200 Message-Id: <1494586944-7253-13-git-send-email-Milos.Stojanovic@rt-rk.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494586944-7253-1-git-send-email-Milos.Stojanovic@rt-rk.com> References: <1494586944-7253-1-git-send-email-Milos.Stojanovic@rt-rk.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 89.216.37.149 X-Mailman-Approved-At: Fri, 12 May 2017 09:02:56 -0400 Subject: [Qemu-devel] [PATCH 12/16] [RFC] linux-user: fix sigismember() check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Milos.Stojanovic@rt-rk.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Fix copying between the host and target signal sets for the case when the target set is larger than the host set. sigismember() returns 1 if the specified signal number is a member of the specified signal set, but it can also return -1 if an error occurs (e.g. an out of range signal number is specified). All non-zero values would cause the signal to be added, so a comparison with 1 is added to assure that only the signals which are really in the set get added to the other set. Signed-off-by: Milo=C5=A1 Stojanovi=C4=87 --- linux-user/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 59d70ec..d72caaf 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -149,7 +149,7 @@ static void host_to_target_sigset_internal(target_sigse= t_t *d, int i; target_sigemptyset(d); for (i =3D 1; i <=3D TARGET_NSIG; i++) { - if (sigismember(s, i)) { + if (sigismember(s, i) =3D=3D 1) { target_sigaddset(d, host_to_target_signal(i)); } } @@ -171,7 +171,7 @@ static void target_to_host_sigset_internal(sigset_t *d, int i; sigemptyset(d); for (i =3D 1; i <=3D TARGET_NSIG; i++) { - if (target_sigismember(s, i)) { + if (target_sigismember(s, i) =3D=3D 1) { sigaddset(d, target_to_host_signal(i)); } } --=20 1.9.1