Blame SOURCES/kexec-tools-2.0.20-vmcore-dmesg-vmcore-dmesg.c-Fix-shifting-error-repor.patch

7a865b
From a46c686f615a86933134c0924c3391ba598a02b8 Mon Sep 17 00:00:00 2001
7a865b
From: Bhupesh Sharma <bhsharma@redhat.com>
7a865b
Date: Tue, 10 Sep 2019 15:51:49 +0530
7a865b
Subject: [PATCH 5/5] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported
7a865b
 by cppcheck
7a865b
7a865b
Running 'cppcheck' static code analyzer (see cppcheck(1))
7a865b
 on 'vmcore-dmesg/vmcore-dmesg.c' shows the following
7a865b
shifting error:
7a865b
7a865b
$ cppcheck  --enable=all  vmcore-dmesg/vmcore-dmesg.c
7a865b
Checking vmcore-dmesg/vmcore-dmesg.c ...
7a865b
[vmcore-dmesg/vmcore-dmesg.c:17]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour
7a865b
7a865b
Fix the same via this patch.
7a865b
7a865b
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
7a865b
Signed-off-by: Simon Horman <horms@verge.net.au>
7a865b
---
7a865b
 vmcore-dmesg/vmcore-dmesg.c | 2 +-
7a865b
 1 file changed, 1 insertion(+), 1 deletion(-)
7a865b
7a865b
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
7a865b
index 81c2a58c9d86..122e53672e01 100644
7a865b
--- a/vmcore-dmesg/vmcore-dmesg.c
7a865b
+++ b/vmcore-dmesg/vmcore-dmesg.c
7a865b
@@ -6,7 +6,7 @@ typedef Elf32_Nhdr Elf_Nhdr;
7a865b
 extern const char *fname;
7a865b
 
7a865b
 /* stole this macro from kernel printk.c */
7a865b
-#define LOG_BUF_LEN_MAX (uint32_t)(1 << 31)
7a865b
+#define LOG_BUF_LEN_MAX (uint32_t)(1U << 31)
7a865b
 
7a865b
 static void write_to_stdout(char *buf, unsigned int nr)
7a865b
 {
7a865b
-- 
7a865b
2.17.1
7a865b