aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2024-09-09 22:42:54 +0200
committerJason Wang <jasowang@redhat.com>2024-10-29 15:53:23 +0800
commite29bc931e1699a98959680f6776b48673825762b (patch)
treedc8b7454c9f8183ce922a3f43286a181cf8c02a0 /net
parent76240dd2a37c7b361740616a7d6080beafdb8a71 (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/colo-compare.c3
1 files changed, 1 insertions, 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, 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)) {