All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix a compilation warning and a static check error
@ 2019-09-10 10:21 Bhupesh Sharma
  2019-09-10 10:21 ` [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck Bhupesh Sharma
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bhupesh Sharma @ 2019-09-10 10:21 UTC (permalink / raw)
  To: kexec; +Cc: bhsharma, bhupesh.linux, horms

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(-)

-- 
2.17.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck
  2019-09-10 10:21 [PATCH 0/2] Fix a compilation warning and a static check error Bhupesh Sharma
@ 2019-09-10 10:21 ` Bhupesh Sharma
  2019-09-10 13:55   ` lijiang
  2019-09-10 10:21 ` [PATCH 2/2] i386/kexec-mb2-x86.c: Fix compilation warning Bhupesh Sharma
  2019-09-16  7:17 ` [PATCH 0/2] Fix a compilation warning and a static check error Simon Horman
  2 siblings, 1 reply; 6+ messages in thread
From: Bhupesh Sharma @ 2019-09-10 10:21 UTC (permalink / raw)
  To: kexec; +Cc: bhsharma, bhupesh.linux, Lianbo Jiang, horms

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 <lijiang@redhat.com>
Cc: Simon Horman <horms@verge.net.au>
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
---
 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 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)
 {
-- 
2.17.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] i386/kexec-mb2-x86.c: Fix compilation warning
  2019-09-10 10:21 [PATCH 0/2] Fix a compilation warning and a static check error Bhupesh Sharma
  2019-09-10 10:21 ` [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck Bhupesh Sharma
@ 2019-09-10 10:21 ` Bhupesh Sharma
  2019-09-16  7:17 ` [PATCH 0/2] Fix a compilation warning and a static check error Simon Horman
  2 siblings, 0 replies; 6+ messages in thread
From: Bhupesh Sharma @ 2019-09-10 10:21 UTC (permalink / raw)
  To: kexec; +Cc: bhsharma, bhupesh.linux, horms

This 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;
      ^~~~~~

Cc: Simon Horman <horms@verge.net.au>
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
---
 kexec/arch/i386/kexec-mb2-x86.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kexec/arch/i386/kexec-mb2-x86.c b/kexec/arch/i386/kexec-mb2-x86.c
index 7eaab0c..b839d59 100644
--- a/kexec/arch/i386/kexec-mb2-x86.c
+++ b/kexec/arch/i386/kexec-mb2-x86.c
@@ -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) {
-- 
2.17.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck
  2019-09-10 10:21 ` [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck Bhupesh Sharma
@ 2019-09-10 13:55   ` lijiang
  2019-09-10 20:02     ` Bhupesh Sharma
  0 siblings, 1 reply; 6+ messages in thread
From: lijiang @ 2019-09-10 13:55 UTC (permalink / raw)
  To: Bhupesh Sharma, kexec; +Cc: bhupesh.linux, horms

在 2019年09月10日 18:21, 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 behaviour
> 
> Fix the same via this patch.
> 
> Cc: Lianbo Jiang <lijiang@redhat.com>
> Cc: Simon Horman <horms@verge.net.au>
> Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
> ---
>  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 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)
> 

This looks better. Thank you, Bhupesh.

>  static void write_to_stdout(char *buf, unsigned int nr)
>  {
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck
  2019-09-10 13:55   ` lijiang
@ 2019-09-10 20:02     ` Bhupesh Sharma
  0 siblings, 0 replies; 6+ messages in thread
From: Bhupesh Sharma @ 2019-09-10 20:02 UTC (permalink / raw)
  To: lijiang; +Cc: Bhupesh SHARMA, kexec mailing list, Simon Horman

On Tue, Sep 10, 2019 at 7:25 PM lijiang <lijiang@redhat.com> wrote:
>
> 在 2019年09月10日 18:21, 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 behaviour
> >
> > Fix the same via this patch.
> >
> > Cc: Lianbo Jiang <lijiang@redhat.com>
> > Cc: Simon Horman <horms@verge.net.au>
> > Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
> > ---
> >  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 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)
> >
>
> This looks better. Thank you, Bhupesh.

Thanks for your review, Lianbo.

Regards,
Bhupesh

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Fix a compilation warning and a static check error
  2019-09-10 10:21 [PATCH 0/2] Fix a compilation warning and a static check error Bhupesh Sharma
  2019-09-10 10:21 ` [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck Bhupesh Sharma
  2019-09-10 10:21 ` [PATCH 2/2] i386/kexec-mb2-x86.c: Fix compilation warning Bhupesh Sharma
@ 2019-09-16  7:17 ` Simon Horman
  2 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2019-09-16  7:17 UTC (permalink / raw)
  To: Bhupesh Sharma; +Cc: bhupesh.linux, kexec

On Tue, Sep 10, 2019 at 03:51:48PM +0530, Bhupesh Sharma wrote:
> 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
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-16  7:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 10:21 [PATCH 0/2] Fix a compilation warning and a static check error Bhupesh Sharma
2019-09-10 10:21 ` [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck Bhupesh Sharma
2019-09-10 13:55   ` lijiang
2019-09-10 20:02     ` Bhupesh Sharma
2019-09-10 10:21 ` [PATCH 2/2] i386/kexec-mb2-x86.c: Fix compilation warning Bhupesh Sharma
2019-09-16  7:17 ` [PATCH 0/2] Fix a compilation warning and a static check error Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.