net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
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>
---
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, 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.39.3 (Apple Git-146)
> -----Original Message----- > From: Stefan Weil <sw@weilnetz.de> > Sent: Tuesday, September 10, 2024 4:43 AM > To: Zhang, Chen <chen.zhang@intel.com>; Li Zhijian <lizhijian@fujitsu.com>; > Jason Wang <jasowang@redhat.com> > Cc: qemu-devel@nongnu.org; Stefan Weil <sw@weilnetz.de> > 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> Looks good to me. Reviewed-by: Zhang Chen <chen.zhang@intel.com> Thanks 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, > 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.39.3 (Apple Git-146)
It looks like nobody has sent a pull request for this fix up to now. Is it trivial enough for qemu-trivial? And maybe qemu-stable could also apply it to older versions. Stefan W. Am 10.09.24 um 04:38 schrieb Zhang, Chen: >> -----Original Message----- >> From: Stefan Weil<sw@weilnetz.de> >> Sent: Tuesday, September 10, 2024 4:43 AM >> To: Zhang, Chen<chen.zhang@intel.com>; Li Zhijian<lizhijian@fujitsu.com>; >> Jason Wang<jasowang@redhat.com> >> Cc:qemu-devel@nongnu.org; Stefan Weil<sw@weilnetz.de> >> 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> > Looks good to me. > Reviewed-by: Zhang Chen<chen.zhang@intel.com> > > Thanks > 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, >> 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.39.3 (Apple Git-146)
Add Trivial patches Maintainers.
Hi Jason/Michael/Laurent,
Can you help to pick up this patch for upstream and stable?
Thanks
Chen
From: Stefan Weil <sw@weilnetz.de>
Sent: Friday, October 18, 2024 3:44 AM
To: Zhang, Chen <chen.zhang@intel.com>; Li Zhijian <lizhijian@fujitsu.com>; Jason Wang <jasowang@redhat.com>; qemu-stable <qemu-stable@nongnu.org>; QEMU Trivial <qemu-trivial@nongnu.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] Fix calculation of minimum in colo_compare_tcp
It looks like nobody has sent a pull request for this fix up to now. Is it trivial enough for qemu-trivial? And maybe qemu-stable could also apply it to older versions.
Stefan W.
Am 10.09.24 um 04:38 schrieb Zhang, Chen:
-----Original Message-----
From: Stefan Weil <sw@weilnetz.de><mailto:sw@weilnetz.de>
Sent: Tuesday, September 10, 2024 4:43 AM
To: Zhang, Chen <chen.zhang@intel.com><mailto:chen.zhang@intel.com>; Li Zhijian <lizhijian@fujitsu.com><mailto:lizhijian@fujitsu.com>;
Jason Wang <jasowang@redhat.com><mailto:jasowang@redhat.com>
Cc: qemu-devel@nongnu.org<mailto:qemu-devel@nongnu.org>; Stefan Weil <sw@weilnetz.de><mailto:sw@weilnetz.de>
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><mailto:sw@weilnetz.de>
Looks good to me.
Reviewed-by: Zhang Chen <chen.zhang@intel.com><mailto:chen.zhang@intel.com>
Thanks
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,
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.39.3 (Apple Git-146)
On Fri, Oct 18, 2024 at 10:48 AM Zhang, Chen <chen.zhang@intel.com> wrote: > > Add Trivial patches Maintainers. > > > > Hi Jason/Michael/Laurent, > > Can you help to pick up this patch for upstream and stable? Queued. Btw, if you want -stable next time, please cc it. Thanks > > > > Thanks > > Chen > > > > From: Stefan Weil <sw@weilnetz.de> > Sent: Friday, October 18, 2024 3:44 AM > To: Zhang, Chen <chen.zhang@intel.com>; Li Zhijian <lizhijian@fujitsu.com>; Jason Wang <jasowang@redhat.com>; qemu-stable <qemu-stable@nongnu.org>; QEMU Trivial <qemu-trivial@nongnu.org> > Cc: qemu-devel@nongnu.org > Subject: Re: [PATCH] Fix calculation of minimum in colo_compare_tcp > > > > It looks like nobody has sent a pull request for this fix up to now. Is it trivial enough for qemu-trivial? And maybe qemu-stable could also apply it to older versions. > > Stefan W. > > Am 10.09.24 um 04:38 schrieb Zhang, Chen: > > -----Original Message----- > > From: Stefan Weil <sw@weilnetz.de> > > Sent: Tuesday, September 10, 2024 4:43 AM > > To: Zhang, Chen <chen.zhang@intel.com>; Li Zhijian <lizhijian@fujitsu.com>; > > Jason Wang <jasowang@redhat.com> > > Cc: qemu-devel@nongnu.org; Stefan Weil <sw@weilnetz.de> > > 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> > > > > Looks good to me. > > Reviewed-by: Zhang Chen <chen.zhang@intel.com> > > > > Thanks > > 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, > > 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.39.3 (Apple Git-146)
© 2016 - 2024 Red Hat, Inc.