From aea3f9f2d8b6ecf6b69df12ba4e99ca44d6813fb Mon Sep 17 00:00:00 2001 From: Thomas Haller 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'". --- lib/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/object.c b/lib/object.c index 234628af..9b147d6c 100644 --- a/lib/object.c +++ b/lib/object.c @@ -399,7 +399,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; }