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: <AANLkTiksQLHDhHSBJG9Xj8n7Lykg9Jpxb3BS739LFEQP@mail.gmail.com>
Date:	Sun, 27 Mar 2011 13:17:23 +0300
From:	Maxin John <maxin.john@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Arnd Bergmann <arnd@...db.de>,
	Jesper Nilsson <jesper.nilsson@...s.com>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: [PATCH] cris/arch-v32: cryptocop: Use kzalloc

This avoids unnecessary explicit initialization by allocating zeroed memory.

Signed-off-by: Maxin B. John<maxin.john@...il.com>
---
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c
b/arch/cris/arch-v32/drivers/cryptocop.c
index c03bc3b..f51b524 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -1394,11 +1394,10 @@ static int create_md5_pad(int alloc_flag,
unsigned long long hashed_length, char

        if (padlen < MD5_MIN_PAD_LENGTH) padlen += MD5_BLOCK_LENGTH;

-       p = kmalloc(padlen, alloc_flag);
+       p = kzalloc(padlen, alloc_flag);
        if (!p) return -ENOMEM;

        *p = 0x80;
-       memset(p+1, 0, padlen - 1);

        DEBUG(printk("create_md5_pad: hashed_length=%lld bits == %lld
bytes\n", bit_length, hashed_length));

@@ -1426,11 +1425,10 @@ static int create_sha1_pad(int alloc_flag,
unsigned long long hashed_length, cha

        if (padlen < SHA1_MIN_PAD_LENGTH) padlen += SHA1_BLOCK_LENGTH;

-       p = kmalloc(padlen, alloc_flag);
+       p = kzalloc(padlen, alloc_flag);
        if (!p) return -ENOMEM;

        *p = 0x80;
-       memset(p+1, 0, padlen - 1);

        DEBUG(printk("create_sha1_pad: hashed_length=%lld bits == %lld
bytes\n", bit_length, hashed_length));

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