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:   Mon, 28 Feb 2022 10:45:13 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     David Airlie <airlied@...ux.ie>
Cc:     linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] agp: Use kcalloc() as a hardening measure

The advantage of the kcalloc() function is that it checks for integer
overflows.  We should use it where ever possible as a safety measure.
Plus it is nicer for style reasons as well.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
 drivers/char/agp/frontend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index 321118a9cfa5..25b27ca0ab47 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -167,7 +167,7 @@ int agp_create_segment(struct agp_client *client, struct agp_region *region)
 	struct agp_segment *user_seg;
 	size_t i;
 
-	seg = kzalloc((sizeof(struct agp_segment_priv) * region->seg_count), GFP_KERNEL);
+	seg = kcalloc(region->seg_count, sizeof(struct agp_segment_priv), GFP_KERNEL);
 	if (seg == NULL) {
 		kfree(region->seg_list);
 		region->seg_list = NULL;
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ