Re: [patch] mm, mempolicy: make mpol_to_str robust and always succeed

2013-09-25 Thread David Rientjes
On Wed, 25 Sep 2013, Andrew Morton wrote: > > I fully agree and have code in the oom killer that has the "fall through" > > comment if there's code in between the case statements, but I think things > > like > > > > case MPOL_BIND: > > case MPOL_INTERLEAVE: > > ... > > > >

Re: [patch] mm, mempolicy: make mpol_to_str robust and always succeed

2013-09-25 Thread Andrew Morton
On Wed, 25 Sep 2013 10:58:27 -0700 (PDT) David Rientjes wrote: > On Tue, 24 Sep 2013, Dave Jones wrote: > > > > /* 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 br

Re: [patch] mm, mempolicy: make mpol_to_str robust and always succeed

2013-09-25 Thread David Rientjes
On Tue, 24 Sep 2013, Dave Jones wrote: > >/* 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

Re: [patch] mm, mempolicy: make mpol_to_str robust and always succeed

2013-09-24 Thread Dave Jones
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;

Re: [patch] mm, mempolicy: make mpol_to_str robust and always succeed

2013-09-24 Thread David Rientjes
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.

Re: [patch] mm, mempolicy: make mpol_to_str robust and always succeed

2013-09-24 Thread Dave Jones
On Tue, Sep 24, 2013 at 07:58:22PM -0700, David Rientjes 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 c

[patch] mm, mempolicy: make mpol_to_str robust and always succeed

2013-09-24 Thread David Rientjes
mpol_to_str() should not fail. Currently, it either fails because the string buffer is too small or because a string hasn't been defined for a mempolicy mode. If a new mempolicy mode is introduced and no string is defined for it, just warn and return "unknown". If the buffer is too small, just t