From: YueHaibing Date: Thu, 28 May 2020 07:48:56 +0000 (+0000) Subject: mt76: mt7615: Use kmemdup in mt7615_queue_key_update() X-Git-Tag: baikal/mips/sdk5.9~13530^2~46^2~2^2~1 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=cda7b7b9b3587e2b8835e8cc32779260f76dca6f;p=kernel.git mt76: mt7615: Use kmemdup in mt7615_queue_key_update() Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing Signed-off-by: Felix Fietkau --- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index 320dfda6b4e5d..c26f99b368d93 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -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;