From a713916eae2af044b6d996bea1e802bc1c808892 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Mon, 25 Sep 2017 10:27:19 -0700 Subject: [PATCH] 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 --- core/hdd/inc/wlan_hdd_main.h | 2 ++ core/hdd/src/wlan_hdd_cfg80211.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 569225c7832b..a39fcdd79d4a 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -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 diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 6033ff086175..5117918d2e2b 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -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; }