From nobody Tue May 7 12:26:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612862435; cv=none; d=zohomail.com; s=zohoarc; b=Hy7vZmp4Obx6Quy2LI3gGOetcB2EekK11j3gjcKxlQbKtUhxAfIU3Ab0sybE76+lmtxv/mhiEpehuay9kuIpOwyeCtNLMG74ke6FxMMO7w78OjCxSTWiSc56ph+m7XZ7ldrxScW6Rtnbq75+RbRKjE1Phr319g5hUBhMWGEi8Zc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612862435; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m/7HGyr+yLhKzAsPfwi/5k6EZKJOv2LSuT2u3MA5lwE=; b=VDvk/OD2NYohE7G/iikNLi+umlzW/CZ2I0Fq55Ipu13LPY2Y3H2bGUEnsYW+rXBqI11RLhhiK6MC26RGIOkBQZ6Bb44q7lshBWdzUOkYXkTP5CMpEMHQUK55Ka9YOpqhnGhVqyZVmHzUJ2T1T1q3R+Lfpb0sDUwihx5PlZPvyGI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612862435195427.86014823690823; Tue, 9 Feb 2021 01:20:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-37-i9QVsJfhPWC--77EPCoMjA-1; Tue, 09 Feb 2021 04:20:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 78CF379EC0; Tue, 9 Feb 2021 09:20:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6BEBF60C05; Tue, 9 Feb 2021 09:20:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C95024EE76; Tue, 9 Feb 2021 09:20:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1199KFWD023842 for ; Tue, 9 Feb 2021 04:20:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 747772026D16; Tue, 9 Feb 2021 09:20:15 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6BDFB2026D49 for ; Tue, 9 Feb 2021 09:20:13 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 793B2101A53B for ; Tue, 9 Feb 2021 09:20:13 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-21-zw9yMaLKPJ-jkXx-h1GmVg-1; Tue, 09 Feb 2021 04:20:10 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DZcl552Ktz165hq for ; Tue, 9 Feb 2021 17:18:41 +0800 (CST) Received: from Y00470486.china.huawei.com (10.174.187.147) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Tue, 9 Feb 2021 17:19:57 +0800 X-MC-Unique: i9QVsJfhPWC--77EPCoMjA-1 X-MC-Unique: zw9yMaLKPJ-jkXx-h1GmVg-1 From: BiaoxiangYe To: Subject: [PATCH v2 1/2] rpc: avoid crash when system time jump back Date: Tue, 9 Feb 2021 09:19:47 +0000 Message-ID: <1612862388-12192-2-git-send-email-yebiaoxiang@huawei.com> In-Reply-To: <1612862388-12192-1-git-send-email-yebiaoxiang@huawei.com> References: <1612862388-12192-1-git-send-email-yebiaoxiang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.147] X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: xiexiangyou@huawei.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: BiaoXiang Ye Setting the system time backward would lead to a multiplication overflow in function virKeepAliveStart. The function virKeepAliveTimerInternal got the same bug too. Backtrace below: #0 0x0000ffffae898470 in raise () from /usr/lib64/libc.so.6 #1 0x0000ffffae89981c in abort () from /usr/lib64/libc.so.6 #2 0x0000ffffaf9a36a8 in __mulvsi3 () from /usr/lib64/libvirt.so.0 #3 0x0000ffffaf8fd9e8 in virKeepAliveStart (ka=3D0xaaaaf954ce10, interval= =3Dinterval entry=3D0, count=3Dcount entry=3D0) at ../../src/rpc/virkeepalive.c:283 #4 0x0000ffffaf908560 in virNetServerClientStartKeepAlive (client=3D0xaaa= af954cbe0) at ../../src/rpc/virnetserverclient.c:1628 #5 0x0000aaaac57eb6dc in remoteDispatchConnectSupportsFeature (server=3D0= xaaaaf95309d0, msg=3D0xaaaaf9549d90, ret=3D0xffff8c007fc0, args=3D0xffff8c002e70, rer= r=3D0xffff9ea054a0, client=3D0xaaaaf954cbe0) at ../../src/remote/remote_daemon_dispatch.c:= 5063 #6 remoteDispatchConnectSupportsFeatureHelper (server=3D0xaaaaf95309d0, c= lient=3D0xaaaaf954cbe0, msg=3D0xaaaaf9549d90, rerr=3D0xffff9ea054a0, args=3D0xffff8c002e70, re= t=3D0xffff8c007fc0) at ./remote/remote_daemon_dispatch_stubs.h:3503 #7 0x0000ffffaf9053a4 in virNetServerProgramDispatchCall(msg=3D0xaaaaf954= 9d90, client=3D0xaaaaf954cbe0, server=3D0x0, prog=3D0xaaaaf953a170) at ../../src/rpc/virnetserverprog= ram.c:451 #8 virNetServerProgramDispatch (prog=3D0xaaaaf953a170, server=3D0x0, serv= er entry=3D0xaaaaf95309d0, client=3D0xaaaaf954cbe0, msg=3D0xaaaaf9549d90) at ../../src/rpc/virnet= serverprogram.c:306 #9 0x0000ffffaf90a6bc in virNetServerProcessMsg (msg=3D, p= rog=3D, client=3D, srv=3D0xaaaaf95309d0) at ../../src/rpc/virne= tserver.c:137 #10 virNetServerHandleJob (jobOpaque=3D0xaaaaf950df80, opaque=3D0xaaaaf953= 09d0) at ../../src/rpc/virnetserver.c:154 #11 0x0000ffffaf812e14 in virThreadPoolWorker (opaque=3D) at ../../src/util/virthreadpool.c:163 #12 0x0000ffffaf81237c in virThreadHelper (data=3D) at ../.= ./src/util/virthread.c:246 #13 0x0000ffffaea327ac in ?? () from /usr/lib64/libpthread.so.0 #14 0x0000ffffae93747c in ?? () from /usr/lib64/libc.so.6 (gdb) frame 3 #3 0x0000ffffaf8fd9e8 in virKeepAliveStart (ka=3D0xaaaaf954ce10, interval= =3Dinterval entry=3D0, count=3Dcount entry=3D0) at ../../src/rpc/virkeepalive.c:283 283 timeout =3D ka->interval - delay; (gdb) list 278 now =3D time(NULL); 279 delay =3D now - ka->lastPacketReceived; <=3D'delay' got a negative = value 280 if (delay > ka->interval) 281 timeout =3D 0; 282 else 283 timeout =3D ka->interval - delay; 284 ka->intervalStart =3D now - (ka->interval - timeout); 285 ka->timer =3D virEventAddTimeout(timeout * 1000, virKeepAliveTimer,= <=3D multiplication overflow 286 ka, virObjectFreeCallback); 287 if (ka->timer < 0) (gdb) p now $2 =3D 18288001 (gdb) p ka->lastPacketReceived $3 =3D 1609430405 Signed-off-by: BiaoXiang Ye Reviewed-by: Jonathon Jongsma --- src/rpc/virkeepalive.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c index 860b91b6b1..786f9038ef 100644 --- a/src/rpc/virkeepalive.c +++ b/src/rpc/virkeepalive.c @@ -31,7 +31,7 @@ #include "virprobe.h" =20 #define VIR_FROM_THIS VIR_FROM_RPC - +#define MICROSEC_PER_SEC (1000 * 1000) VIR_LOG_INIT("rpc.keepalive"); =20 struct _virKeepAlive { @@ -40,8 +40,8 @@ struct _virKeepAlive { int interval; unsigned int count; unsigned int countToDeath; - time_t lastPacketReceived; - time_t intervalStart; + gint64 lastPacketReceived; + gint64 intervalStart; int timer; =20 virKeepAliveSendFunc sendCB; @@ -113,7 +113,7 @@ static bool virKeepAliveTimerInternal(virKeepAlivePtr ka, virNetMessagePtr *msg) { - time_t now =3D time(NULL); + gint64 now =3D g_get_monotonic_time() / MICROSEC_PER_SEC; int timeval; =20 if (ka->interval <=3D 0 || ka->intervalStart =3D=3D 0) @@ -231,9 +231,9 @@ virKeepAliveStart(virKeepAlivePtr ka, unsigned int count) { int ret =3D -1; - time_t delay; + gint64 delay; int timeout; - time_t now; + gint64 now; =20 virObjectLock(ka); =20 @@ -270,7 +270,7 @@ virKeepAliveStart(virKeepAlivePtr ka, "ka=3D%p client=3D%p interval=3D%d count=3D%u", ka, ka->client, interval, count); =20 - now =3D time(NULL); + now =3D g_get_monotonic_time() / MICROSEC_PER_SEC; delay =3D now - ka->lastPacketReceived; if (delay > ka->interval) timeout =3D 0; @@ -375,7 +375,8 @@ virKeepAliveCheckMessage(virKeepAlivePtr ka, virObjectLock(ka); =20 ka->countToDeath =3D ka->count; - ka->lastPacketReceived =3D ka->intervalStart =3D time(NULL); + ka->intervalStart =3D g_get_monotonic_time() / MICROSEC_PER_SEC; + ka->lastPacketReceived =3D ka->intervalStart; =20 if (msg->header.prog =3D=3D KEEPALIVE_PROGRAM && msg->header.vers =3D=3D KEEPALIVE_PROTOCOL_VERSION && --=20 2.23.0 From nobody Tue May 7 12:26:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612862456; cv=none; d=zohomail.com; s=zohoarc; b=dhtArlBS8hIwE0LsG/IcvfD1fXrjzUi/mOfeHrcMRopmVAncBAZRFLVzWwynhBGiqahk8akDBlFcdeYKwZEC1YBtyU1je6+iUxINBMGz6pbOTy9lyMhpBA5RxrMM+K+2z1DMxlXNnx813/7DjDA/F8OIQWyKFvgjQJuJm7rUe8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612862456; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tavDS+5o/EBVEB3aejTqoRZRt3GQOlLp2WysMYmx5MQ=; b=jCYXjJQmA/EZBnDpFvj+wRMSMl//ztZdXY6zwiZGA278vOKOa5KjIv21VJhmHvxaTotn2PCxl2AF4gZBTLbaFGig6lZK9ZkLgXx2GH+er4blZymU73m5AtrRvhEExJ40doBtZ/OfmLhToRszsPX4JnkO3LYvSh7XFSuX4sunRNg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612862456497648.0670820950859; Tue, 9 Feb 2021 01:20:56 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-NaHS4XhYPdSTmYFbEGHgxA-1; Tue, 09 Feb 2021 04:20:51 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86CAE803F4B; Tue, 9 Feb 2021 09:20:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FD995D9C0; Tue, 9 Feb 2021 09:20:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 240B318095CB; Tue, 9 Feb 2021 09:20:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1199KKIW023867 for ; Tue, 9 Feb 2021 04:20:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8AB99110F75C; Tue, 9 Feb 2021 09:20:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 858A2110F0BC for ; Tue, 9 Feb 2021 09:20:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 96107185A79B for ; Tue, 9 Feb 2021 09:20:11 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-256-LkC19E8LMKCe1ry0wkRyIA-1; Tue, 09 Feb 2021 04:20:09 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DZcl54sQSz165cx for ; Tue, 9 Feb 2021 17:18:41 +0800 (CST) Received: from Y00470486.china.huawei.com (10.174.187.147) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Tue, 9 Feb 2021 17:19:57 +0800 X-MC-Unique: NaHS4XhYPdSTmYFbEGHgxA-1 X-MC-Unique: LkC19E8LMKCe1ry0wkRyIA-1 From: BiaoxiangYe To: Subject: [PATCH v2 2/2] rpc: introduce macro MILLISECONDS_PER_SECOND Date: Tue, 9 Feb 2021 09:19:48 +0000 Message-ID: <1612862388-12192-3-git-send-email-yebiaoxiang@huawei.com> In-Reply-To: <1612862388-12192-1-git-send-email-yebiaoxiang@huawei.com> References: <1612862388-12192-1-git-send-email-yebiaoxiang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.147] X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: xiexiangyou@huawei.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: BiaoXiang Ye Use macro instead of magic number, keep the style consistent with MICROSEC_PER_SEC. Signed-off-by: BiaoXiang Ye --- src/rpc/virkeepalive.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c index 786f9038ef..baea2e6478 100644 --- a/src/rpc/virkeepalive.c +++ b/src/rpc/virkeepalive.c @@ -32,6 +32,7 @@ =20 #define VIR_FROM_THIS VIR_FROM_RPC #define MICROSEC_PER_SEC (1000 * 1000) +#define MILLISECONDS_PER_SECOND (1000) VIR_LOG_INIT("rpc.keepalive"); =20 struct _virKeepAlive { @@ -121,7 +122,7 @@ virKeepAliveTimerInternal(virKeepAlivePtr ka, =20 if (now - ka->intervalStart < ka->interval) { timeval =3D ka->interval - (now - ka->intervalStart); - virEventUpdateTimeout(ka->timer, timeval * 1000); + virEventUpdateTimeout(ka->timer, timeval * MILLISECONDS_PER_SECOND= ); return false; } =20 @@ -141,7 +142,7 @@ virKeepAliveTimerInternal(virKeepAlivePtr ka, ka->countToDeath--; ka->intervalStart =3D now; *msg =3D virKeepAliveMessage(ka, KEEPALIVE_PROC_PING); - virEventUpdateTimeout(ka->timer, ka->interval * 1000); + virEventUpdateTimeout(ka->timer, ka->interval * MILLISECONDS_PER_S= ECOND); return false; } } @@ -250,7 +251,7 @@ virKeepAliveStart(virKeepAlivePtr ka, goto cleanup; } /* Guard against overflow */ - if (interval > INT_MAX / 1000) { + if (interval > INT_MAX / MILLISECONDS_PER_SECOND) { virReportError(VIR_ERR_INTERNAL_ERROR, _("keepalive interval %d too large"), interval); goto cleanup; @@ -277,7 +278,8 @@ virKeepAliveStart(virKeepAlivePtr ka, else timeout =3D ka->interval - delay; ka->intervalStart =3D now - (ka->interval - timeout); - ka->timer =3D virEventAddTimeout(timeout * 1000, virKeepAliveTimer, + ka->timer =3D virEventAddTimeout(timeout * MILLISECONDS_PER_SECOND, + virKeepAliveTimer, ka, virObjectFreeCallback); if (ka->timer < 0) goto cleanup; @@ -327,8 +329,8 @@ virKeepAliveTimeout(virKeepAlivePtr ka) if (timeout < 0) timeout =3D 0; /* Guard against overflow */ - if (timeout > INT_MAX / 1000) - timeout =3D INT_MAX / 1000; + if (timeout > INT_MAX / MILLISECONDS_PER_SECOND) + timeout =3D INT_MAX / MILLISECONDS_PER_SECOND; } =20 virObjectUnlock(ka); @@ -336,7 +338,7 @@ virKeepAliveTimeout(virKeepAlivePtr ka) if (timeout < 0) return -1; else - return timeout * 1000; + return timeout * MILLISECONDS_PER_SECOND; } =20 =20 @@ -403,7 +405,7 @@ virKeepAliveCheckMessage(virKeepAlivePtr ka, } =20 if (ka->timer >=3D 0) - virEventUpdateTimeout(ka->timer, ka->interval * 1000); + virEventUpdateTimeout(ka->timer, ka->interval * MILLISECONDS_PER_S= ECOND); =20 virObjectUnlock(ka); =20 --=20 2.23.0