qcacld-3.0: Throw error if nla_parse is used directly

In order to support multiple nla_parse function signatures across
different kernel versions, a new hdd_nla_parse wrapper was introduced.
However, it is easy for propagations or new code to reintroduce
nla_parse. Redefine nla_parse to throw an error, to prevent the
function from being reintroduced into the code base.

Change-Id: I6e9b9cd60cee94dd9f94a067e7b9d964d60ae295
CRs-Fixed: 2116044
This commit is contained in:
Dustin Brown 2017-09-25 10:27:19 -07:00 • committed by snandini
commit a713916eae
2 changed files with 5 additions and 2 deletions

View file

@ -2791,6 +2791,7 @@ static inline void hdd_clear_fils_connection_info(struct hdd_adapter *adapter)
{ }
#endif
#undef nla_parse
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
static inline void hdd_dev_setup_destructor(struct net_device *dev)
{
@ -2816,6 +2817,7 @@ hdd_nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
return nla_parse(tb, maxtype, head, len, policy, NULL);
}
#endif /* KERNEL_VERSION(4, 12, 0) */
#define nla_parse(...) (obsolete, use wlan_cfg80211_nla_parse or hdd_nla_parse)
/**
* hdd_dp_trace_init() - initialize DP Trace by calling the QDF API

View file

@ -11577,8 +11577,9 @@ static int __wlan_hdd_cfg80211_set_limit_offchan_param(struct wiphy *wiphy,
if (ret < 0)
return ret;
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ACTIVE_TOS_MAX, data, data_len,
wlan_hdd_set_limit_off_channel_param_policy)) {
if (hdd_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ACTIVE_TOS_MAX, data,
data_len,
wlan_hdd_set_limit_off_channel_param_policy)) {
hdd_err("Invalid ATTR");
return -EINVAL;
}