From 544ef98f873688d875b453c3f7afc60c4fd0329c Mon Sep 17 00:00:00 2001 From: Bhupesh Sharma Date: Thu, 12 Sep 2019 12:43:23 +0530 Subject: [PATCH] [PATCH] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck Running 'cppcheck' static code analyzer (see cppcheck(1)) on 'vmcore-dmesg/vmcore-dmesg.c' shows the following shifting error: $ cppcheck --enable=all vmcore-dmesg/vmcore-dmesg.c Checking vmcore-dmesg/vmcore-dmesg.c ... [vmcore-dmesg/vmcore-dmesg.c:17]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour Fix the same via this patch. Cc: Lianbo Jiang Signed-off-by: Bhupesh Sharma --- vmcore-dmesg/vmcore-dmesg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c index 41ab73147155..8790738c0e23 100644 --- a/vmcore-dmesg/vmcore-dmesg.c +++ b/vmcore-dmesg/vmcore-dmesg.c @@ -23,7 +23,7 @@ typedef Elf32_Nhdr Elf_Nhdr; /* stole this macro from kernel printk.c */ -#define LOG_BUF_LEN_MAX (uint32_t)(1 << 31) +#define LOG_BUF_LEN_MAX (uint32_t)(1U << 31) static const char *fname; static Elf64_Ehdr ehdr; -- 2.7.4