public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cris/arch-v32: cryptocop: Use kzalloc
@ 2011-03-27 10:17 Maxin John
  2011-03-29 19:47 ` Maxin John
  2011-04-12 10:12 ` Jesper Nilsson
  0 siblings, 2 replies; 3+ messages in thread
From: Maxin John @ 2011-03-27 10:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arnd Bergmann, Jesper Nilsson, Frederic Weisbecker

This avoids unnecessary explicit initialization by allocating zeroed memory.

Signed-off-by: Maxin B. John<maxin.john@gmail.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));

---

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cris/arch-v32: cryptocop: Use kzalloc
  2011-03-27 10:17 [PATCH] cris/arch-v32: cryptocop: Use kzalloc Maxin John
@ 2011-03-29 19:47 ` Maxin John
  2011-04-12 10:12 ` Jesper Nilsson
  1 sibling, 0 replies; 3+ messages in thread
From: Maxin John @ 2011-03-29 19:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arnd Bergmann, Jesper Nilsson, Frederic Weisbecker

ping ..

On Sun, Mar 27, 2011 at 1:17 PM, Maxin John <maxin.john@gmail.com> wrote:
> This avoids unnecessary explicit initialization by allocating zeroed memory.
>
> Signed-off-by: Maxin B. John<maxin.john@gmail.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));
>
> ---
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cris/arch-v32: cryptocop: Use kzalloc
  2011-03-27 10:17 [PATCH] cris/arch-v32: cryptocop: Use kzalloc Maxin John
  2011-03-29 19:47 ` Maxin John
@ 2011-04-12 10:12 ` Jesper Nilsson
  1 sibling, 0 replies; 3+ messages in thread
From: Jesper Nilsson @ 2011-04-12 10:12 UTC (permalink / raw)
  To: Maxin John
  Cc: linux-kernel@vger.kernel.org, Arnd Bergmann, Frederic Weisbecker

On Sun, Mar 27, 2011 at 12:17:23PM +0200, Maxin John wrote:
> This avoids unnecessary explicit initialization by allocating zeroed memory.
> 
> Signed-off-by: Maxin B. John<maxin.john@gmail.com>

Applied, thanks!

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-12 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-27 10:17 [PATCH] cris/arch-v32: cryptocop: Use kzalloc Maxin John
2011-03-29 19:47 ` Maxin John
2011-04-12 10:12 ` Jesper Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox