|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] RE: [PATCH]enable PCI serial card usage
On Wednesday, 2010-3-31 5:09 PM, Keir Fraser wrote:
> On 31/03/2010 03:40, "Wei, Gang" <gang.wei@xxxxxxxxx> wrote:
>
>> + int pb_bdf_enable:1; /* if =1, pb-bdf effective, port behind
>> bridge */ + int ps_bdf_enable:1; /* if =1, ps_bdf effective,
>> port on pci card */
>
> Point of information for you: a signed integer N-bit bit field can
> take values in the range -2^(N-1) to 2^(N-1)-1. In this case N=1 and
> the allowed values are -1 and 0. Hence assigning value 1 to the above
> bit fields has undefined behaviour and some versions of gcc will not
> 'set the flag' as you expect! We've been bitten by it before.
> Generally your bit fields should be *unsigned* unless you
> specifically want signed-integer semantics. Even better here, we'll
> burn the extra bits and use xen_bool_t.
>
> I will fix your patch in this case before applying.
Thanks for point it out. xen_bool_t would be safer for such case.
Jimmy
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|