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>] [day] [month] [year] [list]
Date:   Thu, 5 May 2022 13:32:59 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Won Chung <wonchung@...gle.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] driver core: location: Check for allocations failure

Check whether the kzalloc() succeeds and return false if it fails.

Fixes: 6423d2951087 ("driver core: Add sysfs support for physical location of a device")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
 drivers/base/physical_location.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/physical_location.c b/drivers/base/physical_location.c
index 4c1a52ecd7f6..fbd9f9839e92 100644
--- a/drivers/base/physical_location.c
+++ b/drivers/base/physical_location.c
@@ -24,6 +24,8 @@ bool dev_add_physical_location(struct device *dev)
 
 	dev->physical_location =
 		kzalloc(sizeof(*dev->physical_location), GFP_KERNEL);
+	if (!dev->physical_location)
+		return false;
 	dev->physical_location->panel = pld->panel;
 	dev->physical_location->vertical_position = pld->vertical_position;
 	dev->physical_location->horizontal_position = pld->horizontal_position;
-- 
2.35.1

Powered by blists - more mailing lists