Message ID | 1538730169-145458-1-git-send-email-yuehaibing@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Luca Coelho |
Headers | show |
Series | iwlwifi: acpi: Use kmemdup rather than duplicating its implementation in iwl_parse_nvm_mcc_info | expand |
On Fri, 2018-10-05 at 09:02 +0000, YueHaibing wrote: > Use kmemdup rather than duplicating its implementation > > Signed-off-by: YueHaibing <yuehaibing@huawei.com> > --- Thanks, YueHaibing. I have applied this in our internal tree and it will eventually reach the mainline, following our normal upstreaming process. I have modified the subject and the commit message a bit. -- Cheers, Luca.
On 2018/10/17 15:25, Luciano Coelho wrote: > On Fri, 2018-10-05 at 09:02 +0000, YueHaibing wrote: >> Use kmemdup rather than duplicating its implementation >> >> Signed-off-by: YueHaibing <yuehaibing@huawei.com> >> --- > > Thanks, YueHaibing. I have applied this in our internal tree and it > will eventually reach the mainline, following our normal upstreaming > process. > > I have modified the subject and the commit message a bit. Thanks you! > > -- > Cheers, > Luca. > > > . >
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c index ec300d3..d979c00 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c @@ -1108,14 +1108,12 @@ struct ieee80211_regdomain * 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);
Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing <yuehaibing@huawei.com> --- drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)