lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 Dec 2018 16:42:48 +0800
From:   "huang.zijiang" <huang.zijiang@....com.cn>
To:     perex@...ex.cz
Cc:     tiwai@...e.com, keescook@...omium.org, colin.king@...onical.com,
        w@....eu, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org, xue.zhihong@....com.cn,
        wang.yi59@....com.cn, "huang.zijiang" <huang.zijiang@....com.cn>
Subject: [PATCH] sound:emu10k1:Use kmemdup instead of duplicating its function

From: "huang.zijiang" <huang.zijiang@....com.cn>

kmemdup has implemented the function that kmalloc() and memcpy().

Signed-off-by: huang.zijiang <huang.zijiang@....com.cn>
---
 sound/pci/emu10k1/emufx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 6ebe817..b4fe4c5 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -671,10 +671,9 @@ static unsigned int *copy_tlv(const unsigned int __user *_tlv, bool in_kernel)
 		return NULL;
 	if (data[1] >= MAX_TLV_SIZE)
 		return NULL;
-	tlv = kmalloc(data[1] + sizeof(data), GFP_KERNEL);
+	tlv =  kmemdup(data, data[1] + sizeof(data), GFP_KERNEL);
 	if (!tlv)
 		return NULL;
-	memcpy(tlv, data, sizeof(data));
 	if (in_kernel) {
 		memcpy(tlv + 2, (__force void *)(_tlv + 2),  data[1]);
 	} else if (copy_from_user(tlv + 2, _tlv + 2, data[1])) {
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ