Re: [RFC 03/15] sdp: Use helper functions instead of bt_get_unaligned macro

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

 



Hi Szymon,

On Fri, Aug 31, 2012 at 7:49 AM, Szymon Janc <szymon.janc@xxxxxxxxx> wrote:
>> >         case SDP_INT16:
>> > -               d->val.int16 = bt_get_unaligned((int16_t *) value);
>> > +               d->val.int16 = bt_get_16(value);
>> >                 d->unitSize += sizeof(int16_t);
>> >                 break;
>>
>> Is this safe? You are assigning a unsigned type (return value from
>> bt_get_16()) to a signed one. Same applies for SDP_INT32 and SDP_INT64
>
> Mixing signed and unsigned could introduce some problem when you interpret data (e.g. in
> comparison), but here value will be simply assigned.
>
> I could add an explicit cast here (as this might bother some lint-like tools) if you prefer.

I don't think it is necessary (I was just confirming if it was safe
and intentional), so I'll leave to those who will apply your patches
:)

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux