]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iwlwifi: use kmemdup in iwl_parse_nvm_mcc_info()
authorYueHaibing <yuehaibing@huawei.com>
Fri, 5 Oct 2018 09:02:49 +0000 (09:02 +0000)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 25 Jan 2019 18:57:20 +0000 (20:57 +0200)
Use kmemdup rather than duplicating its implementation in
iwl_parse_nvm_mcc_info().

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c

index 173ade96f119c3a1bd70772a2757a506b24d7d24..484ef4556953e09f625cf2f3733b0ce6257fc099 100644 (file)
@@ -1195,14 +1195,12 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
        regd_to_copy = sizeof(struct ieee80211_regdomain) +
                valid_rules * sizeof(struct ieee80211_reg_rule);
 
-       copy_rd = kzalloc(regd_to_copy, GFP_KERNEL);
+       copy_rd = kmemdup(regd, regd_to_copy, GFP_KERNEL);
        if (!copy_rd) {
                copy_rd = ERR_PTR(-ENOMEM);
                goto out;
        }
 
-       memcpy(copy_rd, regd, regd_to_copy);
-
 out:
        kfree(regdb_ptrs);
        kfree(regd);