Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jul 2023 17:56:08 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: 88284368fa6b - main - ifconfig: Shift unsigned value to avoid UB.
Message-ID:  <202307201756.36KHu8Ge054297@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=88284368fa6b25b9f7b601876794a9f5304ae59f

commit 88284368fa6b25b9f7b601876794a9f5304ae59f
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2023-07-20 17:42:15 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2023-07-20 17:54:56 +0000

    ifconfig: Shift unsigned value to avoid UB.
    
    Reported by:    kib@
---
 sbin/ifconfig/ifconfig_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c
index 0f449b7aae44..d2e3863079e7 100644
--- a/sbin/ifconfig/ifconfig_netlink.c
+++ b/sbin/ifconfig/ifconfig_netlink.c
@@ -88,7 +88,7 @@ print_bits(const char *btype, uint32_t *v, const int v_count,
 	int num = 0;
 
 	for (int i = 0; i < v_count * 32; i++) {
-		bool is_set = v[i / 32] & (1 << (i % 32));
+		bool is_set = v[i / 32] & (1U << (i % 32));
 		if (is_set) {
 			if (num++ == 0)
 				printf("<");



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