From: Dave Jones <davej@redhat.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Chen Gang <gang.chen@asianux.com>, Rik van Riel <riel@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, mempolicy: make mpol_to_str robust and always succeed
Date: Tue, 24 Sep 2013 23:25:30 -0400 [thread overview]
Message-ID: <20130925032530.GA4771@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1309242012070.27940@chino.kir.corp.google.com>
On Tue, Sep 24, 2013 at 08:18:16PM -0700, David Rientjes wrote:
> On Tue, 24 Sep 2013, Dave Jones wrote:
>
> > > case MPOL_BIND:
> > > - /* Fall through */
> > > case MPOL_INTERLEAVE:
> > > nodes = pol->v.nodes;
> > > break;
> >
> > Any reason not to leave this ?
> >
> > "missing break" is the 2nd most common thing that coverity picks up.
> > Most of them are false positives like the above, but the lack of annotations
> > in our source makes it time-consuming to pick through them all to find the
> > real bugs.
> >
>
> Check out things like drivers/mfd/wm5110-tables.c that do things like
>
> switch (reg) {
> case ARIZONA_SOFTWARE_RESET:
> case ARIZONA_DEVICE_REVISION:
> case ARIZONA_CTRL_IF_SPI_CFG_1:
> case ARIZONA_CTRL_IF_I2C1_CFG_1:
> case ARIZONA_CTRL_IF_I2C2_CFG_1:
> case ARIZONA_CTRL_IF_I2C1_CFG_2:
> case ARIZONA_CTRL_IF_I2C2_CFG_2:
> ...
>
> and that file has over 1,000 case statements. Having a
yikes, at first I thought that was output from a code generator.
> /* fall through */
>
> for all of them would be pretty annoying.
agreed, but with that example, it seems pretty obvious (to me at least)
that the lack of break's is intentional. Where it gets trickier to
make quick judgment calls is cases like the one I mentioned above,
where there are only a few cases, and there's real code involved in
some but not all cases.
> I don't remember any coding style rule about this (in fact
> Documentation/CodingStyle has examples of case statements without such a
> comment), I think it's just personal preference so I'll leave it to Andrew
> and what he prefers.
>
> (And if he prefers the /* fall through */ then we should ask that it be
> added to checkpatch.pl since it warns about a million other things and not
> this.)
The question of course is how much gain there is in doing anything at all here.
So far, I've only seen false positives from that checker, but there are hundreds
of them to pick through, so who knows what's further down the pile.
Dave
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-09-25 3:25 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-20 3:56 [PATCH 0/3] mm: mempolicy: the failure processing about mpol_to_str() Chen Gang
2013-08-20 3:57 ` [PATCH 1/3] mm/mempolicy.c: still fill buffer as full as possible when buffer space is not enough in mpol_to_str() Chen Gang
2013-08-20 3:58 ` [PATCH 2/3] fs/proc/task_mmu.c: check the return value of mpol_to_str() Chen Gang
2013-08-20 3:59 ` [PATCH 3/3] mm/shmem.c: " Chen Gang
2013-08-20 5:30 ` [PATCH 0/3] mm: mempolicy: the failure processing about mpol_to_str() Cyrill Gorcunov
2013-08-20 5:41 ` Chen Gang
2013-08-20 6:47 ` Cyrill Gorcunov
2013-08-20 7:48 ` Chen Gang
2013-08-20 7:51 ` Chen Gang
2013-08-20 8:09 ` Chen Gang
2013-08-20 8:13 ` Chen Gang F T
2013-08-20 8:20 ` Chen Gang
2013-08-20 8:25 ` Cyrill Gorcunov
2013-08-20 8:31 ` Chen Gang
2013-08-21 2:21 ` [PATCH 0/3] mm: shmem: check the return value of mpol_to_str() Chen Gang
2013-08-21 2:22 ` [PATCH 1/3] fs/proc/task_mmu.c: " Chen Gang
2013-08-21 2:23 ` [PATCH 2/3] mm/shmem.c: let shmem_show_mpol() return value Chen Gang
2013-08-21 2:24 ` [PATCH 3/3] mm/shmem.c: check the return value of mpol_to_str() Chen Gang
2013-08-21 22:03 ` [PATCH 2/3] mm/shmem.c: let shmem_show_mpol() return value Andrew Morton
2013-08-22 0:52 ` Chen Gang
2013-08-22 1:04 ` [PATCH] mm/shmem.c: check the return value of mpol_to_str() Chen Gang
2013-09-03 5:32 ` Chen Gang
2013-09-05 0:24 ` [PATCH v2] " Chen Gang
2013-09-09 20:30 ` David Rientjes
2013-09-10 0:47 ` Chen Gang
2013-09-10 6:43 ` David Rientjes
2013-09-10 7:01 ` Chen Gang
2013-09-12 0:33 ` David Rientjes
2013-09-12 2:19 ` KOSAKI Motohiro
2013-09-12 3:13 ` Chen Gang
2013-09-13 21:12 ` David Rientjes
2013-09-14 2:51 ` KOSAKI Motohiro
2013-09-16 3:27 ` Chen Gang
2013-09-16 20:13 ` David Rientjes
2013-09-17 0:45 ` Chen Gang
2013-09-17 22:51 ` David Rientjes
2013-09-18 1:20 ` Chen Gang
2013-09-12 3:02 ` Chen Gang
2013-09-12 18:19 ` KOSAKI Motohiro
2013-09-13 2:23 ` Chen Gang
2013-09-13 16:50 ` KOSAKI Motohiro
2013-09-16 2:55 ` Chen Gang
2013-09-16 16:16 ` KOSAKI Motohiro
2013-09-17 1:10 ` Chen Gang
2013-09-17 22:53 ` David Rientjes
2013-09-18 1:37 ` Chen Gang
2013-09-18 22:17 ` David Rientjes
2013-09-13 21:14 ` David Rientjes
2013-09-16 3:17 ` Chen Gang
2013-09-25 2:58 ` [patch] mm, mempolicy: make mpol_to_str robust and always succeed David Rientjes
2013-09-25 3:11 ` Dave Jones
2013-09-25 3:18 ` David Rientjes
2013-09-25 3:25 ` Dave Jones [this message]
2013-09-25 17:58 ` David Rientjes
2013-09-25 21:30 ` Andrew Morton
2013-09-25 22:06 ` David Rientjes
2013-08-21 5:31 ` [PATCH 0/3] mm: shmem: check the return value of mpol_to_str() Cyrill Gorcunov
2013-08-21 5:48 ` Chen Gang
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=20130925032530.GA4771@redhat.com \
--to=davej@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=gang.chen@asianux.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
--cc=rientjes@google.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;
as well as URLs for NNTP newsgroup(s).