#6 Structure Packing Problems

open
nobody
None
5
2001-11-29
2001-11-29
Anonymous
No

All structures that are passed directly down to the
hardware need to be packed. This problem was found
during development of an ARM based system. It caused
memory corruption and crashes...

The fix is to add "__attribute__ ((packed))" to the
named structures
in the specified files:
btcommon.h:
bt_tx_buf
l2cap_timer_obj
l2cap_con
protocol_layer
dlci_struct
rfcomm_con
sdp_con
bt_stat_struct

sdp.c:
security_query

Discussion

  • Logged In: NO

    This request is backwards!! The "__attribute__ ((packed))"
    should be REMOVED from those listed structures since they
    are kernel structures and are NOT passed to the hardware.
    Packing the structures causes kernel data structures (ie.
    timer objects and pointers) to become unaligned. This
    causes memory problems on ARM processors.