Skip to content

Commit

Permalink
mt76: mt7615: Use kmemdup in mt7615_queue_key_update()
Browse files Browse the repository at this point in the history
Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
YueHaibing authored and Felix Fietkau committed May 28, 2020
1 parent f473b42 commit 194a150
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/wireless/mediatek/mt76/mt7615/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,11 @@ mt7615_queue_key_update(struct mt7615_dev *dev, enum set_key_cmd cmd,
wd->type = MT7615_WTBL_KEY_DESC;
wd->sta = msta;

wd->key.key = kzalloc(key->keylen, GFP_KERNEL);
wd->key.key = kmemdup(key->key, key->keylen, GFP_KERNEL);
if (!wd->key.key) {
kfree(wd);
return -ENOMEM;
}
memcpy(wd->key.key, key->key, key->keylen);
wd->key.cipher = key->cipher;
wd->key.keyidx = key->keyidx;
wd->key.keylen = key->keylen;
Expand Down

0 comments on commit 194a150

Please sign in to comment.