All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bhupesh Sharma <bhsharma@redhat.com>
To: lijiang <lijiang@redhat.com>
Cc: Bhupesh SHARMA <bhupesh.linux@gmail.com>,
	kexec mailing list <kexec@lists.infradead.org>,
	Simon Horman <horms@verge.net.au>
Subject: Re: [PATCH 1/2] vmcore-dmesg/vmcore-dmesg.c: Fix shifting error reported by cppcheck
Date: Wed, 11 Sep 2019 01:32:25 +0530	[thread overview]
Message-ID: <CACi5LpOOdxr1c95k69QXp60RwE2CWGC97dqG0mUaVKgNenGgKg@mail.gmail.com> (raw)
In-Reply-To: <50726111-29ef-6054-edd3-f9c9214442e8@redhat.com>

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

  reply	other threads:[~2019-09-10 20:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACi5LpOOdxr1c95k69QXp60RwE2CWGC97dqG0mUaVKgNenGgKg@mail.gmail.com \
    --to=bhsharma@redhat.com \
    --cc=bhupesh.linux@gmail.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=lijiang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.