Fix a compilation warning and a static check error
Subsystems (2)
cover Fix a compilation warning and a static check error
This patchset fixes two kexec-tools issues:
- Fixes a shifting error reported by cppcheck inside 'vmcore-dmesg/vmcore-dmesg.c'.
- Fixes a compilation warning in 'i386/kexec-mb2-x86.c'.
Bhupesh Sharma (2):
vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck i386/kexec-mb2-x86.c: Fix compilation warning
kexec/arch/i386/kexec-mb2-x86.c | 2 -- vmcore-dmesg/vmcore-dmesg.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
Signature · 7 lines
2.17.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/2 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.
--- vmcore-dmesg/vmcore-dmesg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
vmcore-dmesg/vmcore-dmesg.c +1 -1
@@ -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) {
Signature · 7 lines
2.17.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck
Quoted 22 lines · Bhupesh Sharma
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 behaviourFix the same via this patch.
Cc Lianbo Jiang <[email protected]>Cc Simon Horman <[email protected]>Signed-off-by Bhupesh Sharma <[email protected]>--- vmcore-dmesg/vmcore-dmesg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)vmcore-dmesg/vmcore-dmesg.c +0
-0
vmcore-dmesg/vmcore-dmesg.c typedef Elf32_Nhdr Elf_Nhdr; · line 10
Quoted 6 lines
vmcore-dmesg/vmcore-dmesg.c +1
-1@@ -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)
This looks better. Thank you, Bhupesh.
vmcore-dmesg/vmcore-dmesg.c typedef Elf32_Nhdr Elf_Nhdr; · line 12
Quoted 3 lines
vmcore-dmesg/vmcore-dmesg.c +0
-0static void write_to_stdout (char *buf,unsigned int nr) {
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck
Quoted 26 lines · lijiang
Quoted 24 lines · Bhupesh Sharma
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 behaviourFix the same via this patch.
Cc Lianbo Jiang <[email protected]>Cc Simon Horman <[email protected]>Signed-off-by Bhupesh Sharma <[email protected]>--- vmcore-dmesg/vmcore-dmesg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)vmcore-dmesg/vmcore-dmesg.c +0
-0@@ -6,7 +6,7 @@ typedef Elf32_Nhdr Elf_Nhdr;extern const char *fname;
Quoted 6 lines
vmcore-dmesg/vmcore-dmesg.c typedef Elf32_Nhdr Elf_Nhdr; · line 10
Quoted 4 lines
vmcore-dmesg/vmcore-dmesg.c +1
-1/* 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)This looks better. Thank you, Bhupesh.
Thanks for your review, Lianbo.
Regards,
Bhupesh
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/2 i386/kexec-mb2-x86.c: Fix compilation warning
In reply to Bhupesh SharmaThis patch fixes the following compilation warning in 'i386/kexec-mb2-x86.c' regarding the variable 'result' which is set but not used:
kexec/arch/i386/kexec-mb2-x86.c:402:6:
warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
int result;
^~~~~~--- kexec/arch/i386/kexec-mb2-x86.c | 2 -- 1 file changed, 2 deletions(-)
kexec/arch/i386/kexec-mb2-x86.c +0 -2
@@ -399,7 +399,6 @@ int multiboot2_x86_load(int argc, char **argv, const char *buf, off_t len,char *command_line =NULL , *tmp_cmdline =NULL ;int command_line_len;char *imagename, *cp, *append =NULL ;; -int result;int opt;int modules, mod_command_line_space;uint64_t mbi_ptr;
@@ -429,7 +428,6 @@ int multiboot2_x86_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ; modules =0 ; mod_command_line_space =0 ; - result =0 ;while ((opt =getopt_long (argc, argv, short_options, options,0 )) !=-1 ) {switch (opt) {
Signature · 7 lines
2.17.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedQuoted 4 lines · Bhupesh Sharma
This patchset fixes two kexec-tools issues:
- Fixes a shifting error reported by cppcheck inside 'vmcore-dmesg/vmcore-dmesg.c'.
- Fixes a compilation warning in 'i386/kexec-mb2-x86.c'.
Thanks, applied.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec