From nobody Sat Apr 27 04:51:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1557839856; cv=none; d=zoho.com; s=zohoarc; b=lIBokaLY1c+YnRQ6EPajRgp9bYevFT1lR4U1po7LUD/9POCYL/V11Gl6HG8LA6SSDN+Km8NX36dWPOSklYCuZoI3iffuOah8io9kQB70+kQOz15X9OhXrXMwSHd/G7pvjTfhYgkg8jzgI4Y4uK4NWvj81uroPCXpDyHQzaYazyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557839856; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=+b7gAzxqTDavsWMkcjE8pKaepe2T9R7u0k69XCuLHuo=; b=O0pjxM2Z8F/cb1EPrDcD7rMOuo/tn8Cwt+7dxMRzJZYbq/ucRg24NXV4l0zYHXKrxugZgKB+DiR/7h1fWxNSbrpSFEG3fClcpEYNZIrTkz409vK9jwhFbcfp4ECer2fwT77YaG57COCDqbd+KP7ANf7be7XDCVOIL0uEE/zsbxg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557839856143372.1314853735263; Tue, 14 May 2019 06:17:36 -0700 (PDT) Received: from localhost ([127.0.0.1]:48183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQXJE-00035w-ET for importer@patchew.org; Tue, 14 May 2019 09:17:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQXHt-0002Yx-F4 for qemu-devel@nongnu.org; Tue, 14 May 2019 09:16:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQXHq-0005uC-LK for qemu-devel@nongnu.org; Tue, 14 May 2019 09:16:08 -0400 Received: from forwardcorp1p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b6:217]:60378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQXHo-0005lI-1B; Tue, 14 May 2019 09:16:05 -0400 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 97FA22E0B0B; Tue, 14 May 2019 16:15:59 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [2a02:6b8:0:1a2d::30]) by mxbackcorp1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id EGfKYjIG3O-Fxsqnq7J; Tue, 14 May 2019 16:15:59 +0300 Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:fc64:e1ab:53e6:4177]) by smtpcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7hJFJY8ysS-FwluoY2w; Tue, 14 May 2019 16:15:58 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1557839759; bh=zlEvF/oTZJ5liNIhlWTkOCkXgmRQEff72Ptu9kCvEUI=; h=Message-Id:Date:Subject:To:From:Cc; b=fTHYfPCemEkF+ih8ZdjrC4KFSJjO2jKl3CRWv4UBX7v9+V6/MrsekzpTYB3mZmvzr MRab4GI2MzkdSgX/Y6/VYEQtsrgFqCFAI5CyBTTpv2Xm6Ziw/M1mp//CJbpZlOa+Ob lMsD2JXzjhYzy3F6GlGQnUwk0WMP0Zm4Xu/tCIvM= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Yury Kotov To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:15:52 +0300 Message-Id: <20190514131552.15832-1-yury-kotov@yandex-team.ru> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a02:6b8:0:1472:2741:0:8b6:217 Subject: [Qemu-devel] [PATCH RESEND] monitor: Fix return type of monitor_fdset_dup_fd_find 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: qemu-trivial@nongnu.org, armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" monitor_fdset_dup_fd_find_remove() and monitor_fdset_dup_fd_find() returns mon_fdset->id which is int64_t. Downcast from int64_t to int leads = to a bug with removing fd from fdset which id >=3D 2^32. So, fix return types for these function. Signed-off-by: Yury Kotov Reviewed-by: Markus Armbruster --- include/monitor/monitor.h | 2 +- monitor.c | 4 ++-- stubs/fdset.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index c1b40a9cac..2872621afd 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -46,7 +46,7 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_= =3D id, int64_t fdset_id, int monitor_fdset_get_fd(int64_t fdset_id, int flags); int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd); void monitor_fdset_dup_fd_remove(int dup_fd); -int monitor_fdset_dup_fd_find(int dup_fd); +int64_t monitor_fdset_dup_fd_find(int dup_fd); =3D20 void monitor_vfprintf(FILE *stream, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); diff --git a/monitor.c b/monitor.c index 4807bbe811..50e6e820d6 100644 --- a/monitor.c +++ b/monitor.c @@ -2585,7 +2585,7 @@ err: return -1; } =3D20 -static int monitor_fdset_dup_fd_find_remove(int dup_fd, bool remove) +static int64_t monitor_fdset_dup_fd_find_remove(int dup_fd, bool remove) { MonFdset *mon_fdset; MonFdsetFd *mon_fdset_fd_dup; @@ -2613,7 +2613,7 @@ err: return -1; } =3D20 -int monitor_fdset_dup_fd_find(int dup_fd) +int64_t monitor_fdset_dup_fd_find(int dup_fd) { return monitor_fdset_dup_fd_find_remove(dup_fd, false); } diff --git a/stubs/fdset.c b/stubs/fdset.c index 4f3edf2ea4..a1b8f41f62 100644 --- a/stubs/fdset.c +++ b/stubs/fdset.c @@ -7,7 +7,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd= =3D ) return -1; } =3D20 -int monitor_fdset_dup_fd_find(int dup_fd) +int64_t monitor_fdset_dup_fd_find(int dup_fd) { return -1; } --=3D20 2.21.0