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]
Message-Id: <20181206102105.53098-1-wen.yang99@zte.com.cn>
Date:   Thu, 6 Dec 2018 18:21:05 +0800
From:   Wen Yang <wen.yang99@....com.cn>
To:     Kishon Vijay Abraham I <kishon@...com>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Bjorn Helgaas <bhelgaas@...gle.com>
Cc:     linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
        zhong.weidong@....com.cn, Wen Yang <wen.yang99@....com.cn>,
        Bob Copeland <me@...copeland.com>,
        Gustavo Pimentel <gustavo.pimentel@...opsys.com>,
        Niklas Cassel <niklas.cassel@...s.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Cyrille Pitchen <cyrille.pitchen@...e-electrons.com>
Subject: [PATCH] PCI: endpoint: functions: Use kmemdup instead of duplicating its function

kmemdup has implemented the function that kmalloc() + memcpy().
We prefer to kmemdup rather than code opened implementation.

This issue was detected with the help of coccinelle.

Signed-off-by: Wen Yang <wen.yang99@....com.cn>
CC: Bob Copeland <me@...copeland.com>

CC: Kishon Vijay Abraham I <kishon@...com>
CC: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
CC: Bjorn Helgaas <bhelgaas@...gle.com>
CC: Gustavo Pimentel <gustavo.pimentel@...opsys.com>
CC: Niklas Cassel <niklas.cassel@...s.com>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: Cyrille Pitchen <cyrille.pitchen@...e-electrons.com>
CC: linux-pci@...r.kernel.org (open list:PCI ENDPOINT SUBSYSTEM)
CC: linux-kernel@...r.kernel.org (open list)
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 3e86fa3c7da3..6e42daa2a651 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -169,14 +169,12 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test)
 		goto err_addr;
 	}
 
-	buf = kzalloc(reg->size, GFP_KERNEL);
+	buf = kzalloc(src_addr, reg->size, GFP_KERNEL);
 	if (!buf) {
 		ret = -ENOMEM;
 		goto err_map_addr;
 	}
 
-	memcpy(buf, src_addr, reg->size);
-
 	crc32 = crc32_le(~0, buf, reg->size);
 	if (crc32 != reg->checksum)
 		ret = -EIO;
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ