Re: [PATCH] use kzalloc instead of malloc+memset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Denis Vlasenko napsal(a):

On Tuesday 13 September 2005 01:47, Lion Vollnhals wrote:
On Tuesday 13 September 2005 00:10, Lion Vollnhals wrote:
This patch against 2.6.13-mm3 replaces malloc and memset with kzalloc in
drivers/base/class.c .
The following patch converts further kmalllocs and memsets in drivers/base/* to kzallocs.

Please apply.

Signed-off-by: Lion Vollnhals <[email protected]>

diff -Nurp 2.6.13-mm3/drivers/base/platform.c 2.6.13-mm3-changed/drivers/base/platform.c
--- 2.6.13-mm3/drivers/base/platform.c	2005-09-12 23:42:47.000000000 +0200
+++ 2.6.13-mm3-changed/drivers/base/platform.c	2005-09-13 00:23:43.000000000 +0200
@@ -225,13 +225,12 @@ struct platform_device *platform_device_
	struct platform_object *pobj;
	int retval;

-	pobj = kmalloc(sizeof(struct platform_object) + sizeof(struct resource) * num, GFP_KERNEL);
+	pobj = kzalloc(sizeof(struct platform_object) + sizeof(struct resource) * num, GFP_KERNEL);
	if (!pobj) {
		retval = -ENOMEM;
		goto error;
	}

-	memset(pobj, 0, sizeof(*pobj));

Was this a bug or did you just introduced one?
Yes, this was a bug.

--
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      [email protected]      ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux