Strings are always called with -1 (to pull the size-field from strlen itself) for creation. So technically that could be any large constant as well.
> To: [email protected] > CC: [email protected]; [email protected]; [email protected]; [email protected] > Subject: Re: aml: Fix integer types to be unsigned > Date: Sat, 31 Mar 2012 09:49:22 -0600 > From: [email protected] > > > > +_aml_setvalue(struct aml_value *lhs, int type, u_int64_t ival, const void *bval) > > > { > > > memset(&lhs->_, 0x0, sizeof(lhs->_)); > > > > > > @@ -923,7 +920,7 @@ _aml_setvalue(struct aml_value *lhs, int > > > memcpy(lhs->v_buffer, bval, ival); > > > break; > > > case AML_OBJTYPE_STRING: > > > - if (ival == -1) > > > + if ((signed)ival == -1) > > > > Very a-typical way of doing this. Better cast the constant to the > > target type, that's the comon idiom. (signed) is a shorthand for > > (signed int) and not (the signed variant of the type). It is very > > uncommon to use it. > > I've discussed this with Paul a bit. > > The problem he's dealing with is the aml "size" field, which is still > an "int". There's some other fields which are int64_t. > > These are either one step up the call chain, or fetched way way earlier. > > Some of those fields have to change size, but it requires an extensive > audit. > > If there is going to be interpretation of int to long, or unsigned to > signed, it has to be be done in the caller.
