On Sun, Apr 01, 2012 at 01:54:10PM +0300, Paul Irofti wrote:

> [--snip-some-of-the-gyping-from-my-initial-diff--]
> >     case AML_OBJTYPE_STRING:
> > -           if (ival == -1)
> > +           if (ival == (uint64_t)-1)
> 
> This is what I tried first as well. But this cast fails on my x61s where
> ival is set to a 32-bit -1.

I'd like to stress one thing that I did not make clear previously.

If youy cast the lhs to (signed), it is a width reducing conversion,
these are done by just truncating the bits. This has the effect that ANY value
(signed) 0xxxxxxxxxffffffff will be equal to -1. That is certainly not
what you want.

The general lesson is: alway be very suspicious of width reducing
conversions. 

        -Otto

> 
> >                     ival = strlen((const char *)bval);
> >             lhs->length = ival;
> >             lhs->v_string = (char *)acpi_os_malloc(ival+1);

Reply via email to