lkml.org 
[lkml]   [2013]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] gru: fix a sanity test in gru_set_context_option()
On Mon, May 20, 2013 at 08:46:21AM -0500, Dimitri Sivanich wrote:
> On Sun, May 19, 2013 at 09:30:41PM +0300, Dan Carpenter wrote:
> > On Sun, May 19, 2013 at 09:44:42AM -0500, Dimitri Sivanich wrote:
> > >
> > > Since we're here, maybe we should neaten this up a little?
> > >
> > > Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
> > > ---
> > > drivers/misc/sgi-gru/grufault.c | 5 +++--
> > > 1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > Index: linux/drivers/misc/sgi-gru/grufault.c
> > > ===================================================================
> > > --- linux.orig/drivers/misc/sgi-gru/grufault.c
> > > +++ linux/drivers/misc/sgi-gru/grufault.c
> > > @@ -876,8 +876,9 @@ int gru_set_context_option(unsigned long
> > > switch (req.op) {
> > > case sco_blade_chiplet:
> > > /* Select blade/chiplet for GRU context */
> > > - if (req.val1 < -1 || req.val1 >= GRU_MAX_BLADES || !gru_base[req.val1] ||
> > > - req.val0 < -1 || req.val0 >= GRU_CHIPLETS_PER_HUB) {
> > > + if (req.val0 < -1 || req.val0 >= GRU_CHIPLETS_PER_HUB ||
> > > + req.val1 < -1 || req.val1 >= GRU_MAX_BLADES ||
> > > + (req.val1 >= 0 && !gru_base[req.val1])) {
> > > ret = -EINVAL;
> >
> > I generally prefer how in the original code all the sub conditions
> > were aligned nicely but I will Ack your version as well. Thanks.
> >
>
> I guess I'd have to agree. How about this?

Looks nice. Starting with zero is obviously better than the
original.

Acked-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter




\
 
 \ /
  Last update: 2013-05-20 20:41    [W:0.035 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site