From: Michal Hocko <mhocko@suse.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Charan Teja Kalla <quic_charante@quicinc.com>,
kernel test robot <lkp@intel.com>,
Minchan Kim <minchan@kernel.org>,
kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [kbuild-all] Re: mm/madvise.c:1438:6: warning: Redundant assignment of 'ret' to itself. [selfAssignment]
Date: Mon, 20 Jun 2022 21:14:28 +0200 [thread overview]
Message-ID: <YrDHFJkwcn5Ga3yy@dhcp22.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2206201253480.2243@hadrien>
On Mon 20-06-22 12:54:56, Julia Lawall wrote:
>
>
> On Mon, 20 Jun 2022, Michal Hocko wrote:
>
> > On Sat 18-06-22 11:25:43, Charan Teja Kalla wrote:
> > > Hello Andrew,
> > >
> > > On 6/18/2022 4:34 AM, kernel test robot wrote:
> > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > > head: 4b35035bcf80ddb47c0112c4fbd84a63a2836a18
> > > > commit: 5bd009c7c9a9e888077c07535dc0c70aeab242c3 mm: madvise: return correct bytes advised with process_madvise
> > > > date: 3 months ago
> > > > compiler: mips-linux-gcc (GCC) 11.3.0
> > > > reproduce (cppcheck warning):
> > > > # apt-get install cppcheck
> > > > git checkout 5bd009c7c9a9e888077c07535dc0c70aeab242c3
> > > > cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
> > > >
> > > > If you fix the issue, kindly add following tag where applicable
> > > > Reported-by: kernel test robot <lkp@intel.com>
> > > >
> > > >
> > > > cppcheck warnings: (new ones prefixed by >>)
> > > >>> mm/madvise.c:1438:6: warning: Redundant assignment of 'ret' to itself. [selfAssignment]
> > > > ret = (total_len - iov_iter_count(&iter)) ? : ret;
> > >
> > > Other way to avoid this warning is by creating another local variable
> > > that holds the total bytes processed. Having another local variable to
> > > get rid off some compilation warning doesn't seem proper to me. So,
> > > leaving this warning unless you ask me to fix this.
> >
> > Is this a new warning? I do not see it supported by my gcc 10.x. Do we
>
> cppcheck is a static analysis tool. It looks like it doesn't have a
> proper understanding of ?:
Ohh, thanks for the clarification! I thought this was a gcc feature.
Then I would suggest to report a bug report against the static checker
rather than making any changes to the kernel to workaround it.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2022-06-20 19:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 23:04 kernel test robot
2022-06-18 5:55 ` Charan Teja Kalla
2022-06-20 16:29 ` Michal Hocko
2022-06-20 16:54 ` [kbuild-all] " Julia Lawall
2022-06-20 19:14 ` Michal Hocko [this message]
2022-06-22 2:37 ` Chen, Rong A
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=YrDHFJkwcn5Ga3yy@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=julia.lawall@inria.fr \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=minchan@kernel.org \
--cc=quic_charante@quicinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox