Properly define the VLAN_XXX() function macros to avoid miscompilation when
used inside "if" statements comparing with another value. Detailed explanation: "if (a ? b : c != 0)" is not the same like "if ((a ? b : c) != 0)" which is the expected behaviour of a function macro. Affects: toecore, linuxkpi and ibcore. Reviewed by: kib MFC after: 3 days Sponsored by: Mellanox Technologies
This commit is contained in:
parent
aa031ef4a3
commit
b58e7aacf6
@ -143,16 +143,16 @@ struct vlanreq {
|
||||
} while (0)
|
||||
|
||||
#define VLAN_TRUNKDEV(_ifp) \
|
||||
(_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL
|
||||
((_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL)
|
||||
#define VLAN_TAG(_ifp, _vid) \
|
||||
(_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL
|
||||
((_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL)
|
||||
#define VLAN_COOKIE(_ifp) \
|
||||
(_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL
|
||||
((_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL)
|
||||
#define VLAN_SETCOOKIE(_ifp, _cookie) \
|
||||
(_ifp)->if_type == IFT_L2VLAN ? \
|
||||
(*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL
|
||||
((_ifp)->if_type == IFT_L2VLAN ? \
|
||||
(*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL)
|
||||
#define VLAN_DEVAT(_ifp, _vid) \
|
||||
(_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_vid)) : NULL
|
||||
((_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_vid)) : NULL)
|
||||
|
||||
extern void (*vlan_trunk_cap_p)(struct ifnet *);
|
||||
extern struct ifnet *(*vlan_trunkdev_p)(struct ifnet *);
|
||||
|
Loading…
Reference in New Issue
Block a user