From nobody Sun May 5 19:31:20 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=1558604774; cv=none; d=zoho.com; s=zohoarc; b=ZW8TEPAXXPJHmB5pBMTzf1yR+kXhwaZhndwm++fVgAu5MJltBBWo7iF3FoT9xtucM3ixI6HpZLkfSL7WO2qK3L5ePf1Ulrg1ITMUR73gcGoggH1o/0B9VRQCPM3SnSTtcnW3nM7g441O4I0nmh+0g+5ckKeJiDTfR9VZDntJ+Mw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604774; 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=nH7A+kzdlwSSCdcQPhUp5VHaBN9bPGJqQQQxHRoTxiM=; b=GV8LpKGv7F04Efmj7aJcBnfEgJSoaZCm7ZUa7InigVboesdNIq8m4iAFDPeRUTSWsWMvalVmxfRP32XRmNcHjcZGca58QuEpyRPJ3JL1Ng5Wgz7FUOkQgzGd+xCqjDaXfjtsVji3OvvtgArKR6+QpH/89StCDSxHF+znK+gJzHE= 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 1558604774838523.1328393775538; Thu, 23 May 2019 02:46:14 -0700 (PDT) Received: from localhost ([127.0.0.1]:60875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTkIa-0006Fe-VV for importer@patchew.org; Thu, 23 May 2019 05:46:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTkHJ-0005a4-68 for qemu-devel@nongnu.org; Thu, 23 May 2019 05:44:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTkHI-0007JN-8l for qemu-devel@nongnu.org; Thu, 23 May 2019 05:44:49 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:47694) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTkHI-0007IN-2k for qemu-devel@nongnu.org; Thu, 23 May 2019 05:44:48 -0400 Received: from mxbackcorp2j.mail.yandex.net (mxbackcorp2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::119]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 3029C2E0AF3; Thu, 23 May 2019 12:44:44 +0300 (MSK) Received: from smtpcorp1j.mail.yandex.net (smtpcorp1j.mail.yandex.net [2a02:6b8:0:1619::137]) by mxbackcorp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id v7QKV5QSmA-ih5isQT1; Thu, 23 May 2019 12:44:44 +0300 Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:d05b:c3b5:9878:7629]) by smtpcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a66T7ncC5r-ih80rIK3; Thu, 23 May 2019 12:44:43 +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=1558604684; bh=SI0jxpLyVqp6a2uHfKYSeiX7vKJYR+MCO0k9TYvwkno=; h=Message-Id:Date:Subject:To:From:Cc; b=fSHGoPNtiqavFlkTxayfj7Rygy8eXW6cD7KqszxKVL7+dhXshywRSryjaifgJbfOk PYjEqnIXHRNSb8amCqHYHN3nY/kreGcsabDpUvPf6tuHyV7SCMHHxTBBFgmkuHbV8V mvk2M8/4XDJJC7irT8sgEHF2LxZf0EYoK4LX/Gm0= Authentication-Results: mxbackcorp2j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Yury Kotov To: Markus Armbruster , Eric Blake , qemu-devel@nongnu.org Date: Thu, 23 May 2019 12:44:33 +0300 Message-Id: <20190523094433.30297-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: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 77.88.29.217 Subject: [Qemu-devel] [PATCH v3] 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: Paolo Bonzini , "Dr. David Alan Gilbert" 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() return mon_fdset->id which is int64_t. Downcasting from int64_t to int leads to a bug with removing fd from fdset with 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 86656297f1..51f048d61f 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -45,6 +45,6 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_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); =20 #endif /* MONITOR_H */ diff --git a/monitor.c b/monitor.c index 6428eb3b7e..a0e637f7d6 100644 --- a/monitor.c +++ b/monitor.c @@ -2602,7 +2602,7 @@ err: return -1; } =20 -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; @@ -2630,7 +2630,7 @@ err: return -1; } =20 -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) return -1; } =20 -int monitor_fdset_dup_fd_find(int dup_fd) +int64_t monitor_fdset_dup_fd_find(int dup_fd) { return -1; } --=20 2.21.0