31 lines
856 B
Diff
31 lines
856 B
Diff
From aea3f9f2d8b6ecf6b69df12ba4e99ca44d6813fb Mon Sep 17 00:00:00 2001
|
|
From: Thomas Haller <thaller@redhat.com>
|
|
Date: Fri, 1 Dec 2023 20:06:36 +0100
|
|
Subject: [PATCH] lib: fix signed overflow warning in nl_object_diff()
|
|
|
|
Coverity warns "Signed integer overflow for expression '1<<31'".
|
|
|
|
Conflict:NA
|
|
Reference:https://github.com/thom311/libnl/commit/aea3f9f2d8b6ecf6b69df12ba4e99ca44d6813fb
|
|
|
|
---
|
|
lib/object.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/object.c b/lib/object.c
|
|
index bef0b6f..cca4c48 100644
|
|
--- a/lib/object.c
|
|
+++ b/lib/object.c
|
|
@@ -392,7 +392,7 @@ uint32_t nl_object_diff(struct nl_object *a, struct nl_object *b)
|
|
diff = nl_object_diff64(a, b);
|
|
|
|
return (diff & ~((uint64_t) 0xFFFFFFFF))
|
|
- ? (uint32_t) diff | (1 << 31)
|
|
+ ? (uint32_t) diff | (((uint32_t ) 1u) << 31)
|
|
: (uint32_t) diff;
|
|
}
|
|
|
|
--
|
|
2.33.0
|
|
|