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

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