util-linux/backport-lib-caputils-fix-integer-handling-issues-coverity-sc.patch
zhangyao 6fe20796c6 sync community patches
(cherry picked from commit f49f6cd29674753ced6d761a00d155692ace3380)
2023-06-15 15:29:09 +08:00

27 lines
781 B
Diff

From 01a0a556018694bfaf6b01a5a40f8d0d10641a1f Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 18 May 2023 10:26:02 +0200
Subject: [PATCH] lib/caputils: fix integer handling issues [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
---
lib/caputils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/caputils.c b/lib/caputils.c
index 3041c3078..23866c071 100644
--- a/lib/caputils.c
+++ b/lib/caputils.c
@@ -119,7 +119,7 @@ void cap_permitted_to_ambient(void)
if (cap > (uint64_t) cap_last_cap())
continue;
- if ((effective & (1 << cap))
+ if ((effective & (1ULL << cap))
&& prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, cap, 0, 0) < 0)
err(EXIT_FAILURE, _("prctl(PR_CAP_AMBIENT) failed"));
}
--
2.33.0