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:	Tue,  7 Jul 2015 07:55:42 +0200
From:	Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:	starvik@...s.com, jesper.nilsson@...s.com
Cc:	linux-cris-kernel@...s.com, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] cris: arch-v32: gpio: Use kzalloc instead of kmalloc/memset

Turn a kmalloc/memset into an equivalent kzalloc.
Doing so also move the zero'ing of the memory outside of a mutex.

Signed-off-by: Christophe Jaillet <christophe.jaillet@...adoo.fr>
---
A simililar patch has already been applied against
arch/cris/arch-v32/drivers/mach-fs/gpio.c
---
 arch/cris/arch-v32/drivers/mach-a3/gpio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index 74f9fe8..75f0264 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -386,13 +386,12 @@ static int gpio_open(struct inode *inode, struct file *filp)
 	    (p > GPIO_MINOR_LAST && p < GPIO_MINOR_PWM0))
 		return -EINVAL;
 
-	priv = kmalloc(sizeof(struct gpio_private), GFP_KERNEL);
+	priv = kzalloc(sizeof(struct gpio_private), GFP_KERNEL);
 
 	if (!priv)
 		return -ENOMEM;
 
 	mutex_lock(&gpio_mutex);
-	memset(priv, 0, sizeof(*priv));
 
 	priv->minor = p;
 	filp->private_data = priv;
-- 
2.1.4

--
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