Skip to content
  • Thomas Haller's avatar
    platform: use NM_CMP_FIELD_UNSAFE() for comparing bitfield in nm_platform_qdisc_cmp() · 366d3af0
    Thomas Haller authored and Lubomir Rintel's avatar Lubomir Rintel committed
    "NM_CMP_FIELD (a, b, fq_codel.ecn == TRUE)" is quite a hack as it relies on
    the implementation of the macro in a particular way. The problem is, that
    NM_CMP_FIELD() uses typeof() which cannot be used with bitfields. So, the
    nicer solution is to use NM_CMP_FIELD_UNSAFE() which exists exactly for bitfields
    (it's "unsafe", because it evaluates arguments more than once as it avoids
    the temporary variable with typeof()).
    
    Same with nm_hash_update_vals() which uses typeof() to avoid evaluating
    arguments more than once. But that again does not work with bitfields.
    The "proper" way is to use NM_HASH_COMBINE_BOOLS().
    
    (cherry picked from commit 47d8bee1)
    366d3af0