Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Apr 2022 20:17:59 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9983e5cce6c7 - main - cxgbe(4): Fix the sorting order of the regions listed in meminfo.
Message-ID:  <202204062017.236KHxuX025026@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=9983e5cce6c77c791bd914648b2acc2e54acc515

commit 9983e5cce6c77c791bd914648b2acc2e54acc515
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2022-04-05 21:13:11 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2022-04-06 20:15:25 +0000

    cxgbe(4): Fix the sorting order of the regions listed in meminfo.
    
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgbe/t4_main.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 56ceae56a700..898a1d1ca4f3 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -9656,16 +9656,23 @@ sysctl_linkdnrc(SYSCTL_HANDLER_ARGS)
 }
 
 struct mem_desc {
-	unsigned int base;
-	unsigned int limit;
-	unsigned int idx;
+	u_int base;
+	u_int limit;
+	u_int idx;
 };
 
 static int
 mem_desc_cmp(const void *a, const void *b)
 {
-	return ((const struct mem_desc *)a)->base -
-	       ((const struct mem_desc *)b)->base;
+	const u_int v1 = ((const struct mem_desc *)a)->base;
+	const u_int v2 = ((const struct mem_desc *)b)->base;
+
+	if (v1 < v2)
+		return (-1);
+	else if (v1 > v2)
+		return (1);
+
+	return (0);
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202204062017.236KHxuX025026>