From nobody Sun Nov 24 06:53:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1725914643; cv=none; d=zohomail.com; s=zohoarc; b=ZR09VSFeAbCyP866c10bT2jXXJ3wMZ4cgakMXTXXnzacc59jITelSdQwtXVGg6tBABmcTSwLZpteSLTuRNeyiWSUsOiA9TAzPV7plPs61uOo6evHFLiyaGAt36DE1qyg5Eqrg6vcZradSPuk1GStWSywNPc80RdR5EG3h6PQ41c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725914643; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=g6hWYvOciwy8kUaGdrUBivkj3OVQNdA5zxLlc+9qiY4=; b=BdLH9c02SVt+qr693FoCVYMvYQfdPirWAA2ghnFZyWcHpMtgtpGgNNSZjnfCfVwE8/hnB0yjr3eZW/knvkDYsHcCUCU7ac76njNx9scoieheyzGd19w+X5t1D4n1nP4QPF4WUQA5874QE7revdUZs1BIzCku0XXyE55qycrKtkA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725914643713659.8324290960323; Mon, 9 Sep 2024 13:44:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snlE7-0002DI-Kw; Mon, 09 Sep 2024 16:43:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1snlE1-0002CL-Kt for qemu-devel@nongnu.org; Mon, 09 Sep 2024 16:43:05 -0400 Received: from mail.weilnetz.de ([37.120.169.71] helo=mail.v2201612906741603.powersrv.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1snlDz-00085L-4I for qemu-devel@nongnu.org; Mon, 09 Sep 2024 16:43:04 -0400 Received: from qemu.weilnetz.de (qemu.weilnetz.de [188.68.58.204]) by mail.v2201612906741603.powersrv.de (Postfix) with ESMTP id 016B7DA0552; Mon, 9 Sep 2024 22:42:59 +0200 (CEST) Received: by qemu.weilnetz.de (Postfix, from userid 1000) id 862AD460030; Mon, 9 Sep 2024 22:42:58 +0200 (CEST) Authentication-Results: mail.v2201612906741603.powersrv.de; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=weilnetz.de (policy=none); spf=softfail (mail.v2201612906741603.powersrv.de: 188.68.58.204 is neither permitted nor denied by domain of stefan@weilnetz.de) smtp.mailfrom=stefan@weilnetz.de To: Zhang Chen , Li Zhijian , Jason Wang Cc: qemu-devel@nongnu.org, Stefan Weil Subject: [PATCH] Fix calculation of minimum in colo_compare_tcp Date: Mon, 9 Sep 2024 22:42:54 +0200 Message-Id: <20240909204254.1446800-1-sw@weilnetz.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 016B7DA0552 X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.50 / 14.00]; VIOLATED_DIRECT_SPF(3.50)[]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; FORGED_SENDER(0.30)[sw@weilnetz.de,stefan@weilnetz.de]; RCVD_NO_TLS_LAST(0.10)[]; DMARC_POLICY_SOFTFAIL(0.10)[weilnetz.de : No valid SPF, No valid DKIM,quarantine,sampled_out]; MIME_GOOD(-0.10)[text/plain]; ONCE_RECEIVED(0.10)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:197540, ipnet:188.68.56.0/22, country:DE]; RCVD_COUNT_ONE(0.00)[1]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[weilnetz.de:mid,weilnetz.de:email]; R_DKIM_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; FROM_NEQ_ENVFROM(0.00)[sw@weilnetz.de,stefan@weilnetz.de]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; ARC_NA(0.00)[] X-Rspamd-Server: v2201612906741603 X-Rspamd-Action: no action Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=37.120.169.71; envelope-from=stefan@weilnetz.de; helo=mail.v2201612906741603.powersrv.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Stefan Weil From: Stefan Weil via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1725914645641116600 Content-Type: text/plain; charset="utf-8" GitHub's CodeQL reports a critical error which is fixed by using the MIN ma= cro: Unsigned difference expression compared to zero Signed-off-by: Stefan Weil Reviewed-by: Zhang Chen --- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index c4ad0ab71f..39f90c4065 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -412,8 +412,7 @@ static void colo_compare_tcp(CompareState *s, Connectio= n *conn) * can ensure that the packet's payload is acknowledged by * primary and secondary. */ - uint32_t min_ack =3D conn->pack - conn->sack > 0 ? - conn->sack : conn->pack; + uint32_t min_ack =3D MIN(conn->pack, conn->sack); =20 pri: if (g_queue_is_empty(&conn->primary_list)) { --=20 2.39.3 (Apple Git-146)