[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Crash-utility] [PATCH] Remove the VOID_PTR facilitator macro



Dne pátek 28 Leden 2011 01:14:51 Petr Tesarik napsal(a):
> Dne čtvrtek 27 Leden 2011 19:47:41 Dave Anderson napsal(a):
> > ----- Original Message -----
> > 
> > > Hi Dave,
> > > 
> > > > BTW, was there a reason that you changed this?:
> > > >                  if (si->c_flags & SLAB_CFLGS_BUFCTL)
> > > > 
> > > > - obj = si->s_mem + ((next - si->s_index) * si->c_offset);
> > > > + obj = si->s_mem + (next - si->s_index) * si->c_offset;
> > > 
> > > It wasn't my patch so I'm only offering my ACK for the original change
> > > and my reason is that multiply has higher operator precedence than add
> > > (and subtract) in normal arithmetic so the outer parentheses were
> > > never necessary anyway. They didn't create an error but they weren't
> > > needed either. The inner parentheses are required.
> > > 
> > > --
> > > David Mair.
> > 
> > Right I understand that, but the sources are full of such
> > "extra" parentheses, some to prevent compiler warnings, but
> > mostly just for ease of maintainability/understanding.
> > 
> > I just was wondering why that line was explicitly changed.
> 
> No reason, except I removed them for some reason while developing the patch
> and forgot to put them back afterwards. I can leave it as-is.
> 
> Oh, I've just realized that this actually changed the expression, because
> originally both variables were pointers to ulong, so
> 
> (next - si->s_index)
> 
> should become
> 
> ((next - si->s_index)/sizeof(ulong))
> 
> I wonder whether this was originally intended. Let me have one more look at
> this.

I had to dig back in 2.2.x sources, but the divide should indeed be there. 
I'll send an updated patch tomorrow (too late for me in Europe now).

Petr


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]