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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1528773636-37730-1-git-send-email-jiazhouyang09@gmail.com>
Date:   Tue, 12 Jun 2018 11:20:36 +0800
From:   Zhouyang Jia <jiazhouyang09@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Zhouyang Jia <jiazhouyang09@...il.com>,
        Alessandro Rubini <rubini@...dd.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] fmc: add error handling for kmemdup

When kmemdup fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling kmemdup.

Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
---
 drivers/fmc/fmc-fakedev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/fmc/fmc-fakedev.c b/drivers/fmc/fmc-fakedev.c
index 941d093..62d9046 100644
--- a/drivers/fmc/fmc-fakedev.c
+++ b/drivers/fmc/fmc-fakedev.c
@@ -282,6 +282,9 @@ static struct ff_dev *ff_dev_create(void)
 	for (i = 0; i < ff_nr_dev; i++) {
 		fmc = kmemdup(&ff_template_fmc, sizeof(ff_template_fmc),
 			      GFP_KERNEL);
+		if (!fmc)
+			return ERR_PTR(-ENOMEM);
+
 		fmc->hwdev = &ff->dev;
 		fmc->carrier_data = ff;
 		fmc->nr_slots = ff_nr_dev;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ