37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
|
|
From 9a0cd347854db393076683b6321c85359d530490 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Stefan Weil <sw@weilnetz.de>
|
||
|
|
Date: Mon, 9 Sep 2024 22:42:54 +0200
|
||
|
|
Subject: [PATCH] Fix calculation of minimum in colo_compare_tcp
|
||
|
|
|
||
|
|
GitHub's CodeQL reports a critical error which is fixed by using the MIN macro:
|
||
|
|
|
||
|
|
Unsigned difference expression compared to zero
|
||
|
|
|
||
|
|
Signed-off-by: Stefan Weil <sw@weilnetz.de>
|
||
|
|
Cc: qemu-stable@nongnu.org
|
||
|
|
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
|
||
|
|
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
||
|
|
(cherry picked from commit e29bc931e1699a98959680f6776b48673825762b)
|
||
|
|
Signed-off-by: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
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 b966e7e514..e845c63f2e 100644
|
||
|
|
--- a/net/colo-compare.c
|
||
|
|
+++ b/net/colo-compare.c
|
||
|
|
@@ -414,8 +414,7 @@ static void colo_compare_tcp(CompareState *s, Connection *conn)
|
||
|
|
* can ensure that the packet's payload is acknowledged by
|
||
|
|
* primary and secondary.
|
||
|
|
*/
|
||
|
|
- uint32_t min_ack = conn->pack - conn->sack > 0 ?
|
||
|
|
- conn->sack : conn->pack;
|
||
|
|
+ uint32_t min_ack = MIN(conn->pack, conn->sack);
|
||
|
|
|
||
|
|
pri:
|
||
|
|
if (g_queue_is_empty(&conn->primary_list)) {
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|