From: Simon Guo <wei.guo.simon@gmail.com>
To: Daniel Axtens <dja@axtens.net>
Cc: linuxppc-dev@lists.ozlabs.org,
Anshuman Khandual <khandual@linux.vnet.ibm.com>
Subject: Re: [PATCH] powerpc/ptrace: Fix cppcheck issue in gpr32_set_common/gpr32_get_common.
Date: Wed, 24 Aug 2016 15:38:27 +0800 [thread overview]
Message-ID: <20160824073826.GA16442@simonLocalRHEL7.x64> (raw)
In-Reply-To: <878tvmrjoc.fsf@possimpible.ozlabs.ibm.com>
Hi Daniel,
On Wed, Aug 24, 2016 at 12:21:23PM +1000, Daniel Axtens wrote:
> Hi Simon,
>
> > The ckpt_regs usage in gpr32_set_common/gpr32_get_common()
> > will lead to cppcheck error.
> >
> > [arch/powerpc/kernel/ptrace.c:2062]: (error) Uninitialized variable: ckpt_regs
> > [arch/powerpc/kernel/ptrace.c:2130]: (error) Uninitialized variable: ckpt_regs
> >
> > A straightforward fix to clean it.
>
> I'm always happy to see cppcheck warnings fixed :)
Thanks for raising this issue :)
>
> > static int gpr32_get_common(struct task_struct *target,
> > const struct user_regset *regset,
> > unsigned int pos, unsigned int count,
> > +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
> > void *kbuf, void __user *ubuf, bool tm_active)
> > +#else
> > + void *kbuf, void __user *ubuf)
> > +#endif
>
> I wonder if it might be possible to avoid some of the ifdefs and general
> churn by making the tm_active argument __maybe_unused rather than
> ifdefing around it?
>
> In particular, it would mean the two hunks in the function definitions
> and these these two hunks at the call site would be unnecessary:
I think keeping tm_active argument for "ifndef CONFIG_PPC_TRANSACTIONAL_MEM"
case (with __maybe_unused prefix) will be somehow strange -- Whatever
value is provided in the caller function for tm_active, programmer might be
puzzled and cost sometime to think about it. I don't like to use
"__maybe_unused" to bypass this warning.
Thanks,
- Simon
next prev parent reply other threads:[~2016-08-24 7:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-20 12:24 [PATCH] powerpc/ptrace: Fix cppcheck issue in gpr32_set_common/gpr32_get_common wei.guo.simon
2016-08-24 2:21 ` Daniel Axtens
2016-08-24 7:38 ` Simon Guo [this message]
2016-08-25 1:06 ` Daniel Axtens
2016-09-09 10:52 ` Michael Ellerman
2016-09-11 12:07 ` Simon Guo
2016-09-12 1:55 ` Michael Ellerman
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=20160824073826.GA16442@simonLocalRHEL7.x64 \
--to=wei.guo.simon@gmail.com \
--cc=dja@axtens.net \
--cc=khandual@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).