summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhupesh Sharma <bhsharma@redhat.com>2019-09-10 15:51:49 +0530
committerSimon Horman <horms@verge.net.au>2019-09-16 09:17:10 +0200
commita46c686f615a86933134c0924c3391ba598a02b8 (patch)
treec1a8e5342fbffac2195b6b4094fafd1c0871346c
parentfa3f0ed47f3e6dbee485722d13713ad495571b7e (diff)
downloadkexec-tools-a46c686f615a86933134c0924c3391ba598a02b8.tar.gz
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. Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--vmcore-dmesg/vmcore-dmesg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
index 81c2a58..122e536 100644
--- a/vmcore-dmesg/vmcore-dmesg.c
+++ b/vmcore-dmesg/vmcore-dmesg.c
@@ -6,7 +6,7 @@ typedef Elf32_Nhdr Elf_Nhdr;
extern const char *fname;
/* 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 void write_to_stdout(char *buf, unsigned int nr)
{