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: <1435559640-18059-1-git-send-email-maninder1.s@samsung.com>
Date:	Mon, 29 Jun 2015 12:04:00 +0530
From:	Maninder Singh <maninder1.s@...sung.com>
To:	rjw@...ysocki.net, lenb@...nel.org, linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc:	pankaj.m@...sung.com, Maninder Singh <maninder1.s@...sung.com>
Subject: [PATCH 1/1] ACPI/resource.c: Fixing memory leak for reg

static analysis gives memory leak error for reg:-
[drivers/acpi/resource.c:663]: (error) Memory leak: reg

Thus to prevent this allocate memory for reg after
request_range error checking.

Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
Reviewed-by: Akhilesh Kumar <akhilesh.k@...sung.com>
---
 drivers/acpi/resource.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index fcb7807..f942b70 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -655,14 +655,14 @@ static int add_region_before(u64 start, u64 end, u8 space_id,
 	struct reserved_region *reg;
 	int error;
 
-	reg = kmalloc(sizeof(*reg), GFP_KERNEL);
-	if (!reg)
-		return -ENOMEM;
-
 	error = request_range(start, end, space_id, flags, desc);
 	if (error)
 		return error;
 
+	reg = kmalloc(sizeof(*reg), GFP_KERNEL);
+	if (!reg)
+		return -ENOMEM;
+
 	reg->start = start;
 	reg->end = end;
 	list_add_tail(&reg->node, head);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ