[lxc-devel] [lxc/master] utils: use 1LU otherwise we overflow

brauner on Github lxc-bot at linuxcontainers.org
Tue Jun 20 00:49:27 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170620/13398d72/attachment.bin>
-------------- next part --------------
From 6fbcbe3bd74043c8685aa7254915e87620494c66 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 20 Jun 2017 02:48:47 +0200
Subject: [PATCH] utils: use 1LU otherwise we overflow

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/utils.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index 4419e672e..9d88076c5 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -1923,12 +1923,14 @@ bool task_blocking_signal(pid_t pid, int signal)
 		return bret;
 
 	while (getline(&line, &n, f) != -1) {
-		if (!strncmp(line, "SigBlk:\t", 8))
-			if (sscanf(line + 8, "%lx", &sigblk) != 1)
-				goto out;
+		if (strncmp(line, "SigBlk:\t", 8))
+			continue;
+
+		if (sscanf(line + 8, "%lx", &sigblk) != 1)
+			goto out;
 	}
 
-	if (sigblk & (1 << (signal - 1)))
+	if (sigblk & (1LU << (signal - 1)))
 		bret = true;
 
 out:


More information about the lxc-devel mailing list