Use kmemdup rather than duplicating its implementation
Signed-off-by: YueHaibing <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
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);
On Fri, 2018-10-05 at 09:02 +0000, YueHaibing wrote:
> Use kmemdup rather than duplicating its implementation
>
> Signed-off-by: YueHaibing <[email protected]>
> ---
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 <[email protected]>
>> ---
>
> 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.
>
>
> .
>