WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Substitute kmalloc+memset by kzalloc where possible

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Substitute kmalloc+memset by kzalloc where possible
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 17 Mar 2006 18:22:22 +0000
Delivery-date: Fri, 17 Mar 2006 18:23:56 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 56ec142bdd91c6ecdc2395d7c21534efd893a14a
# Parent  796ac2386a24b359a88e4924a064bac09c0625e2
Substitute kmalloc+memset by kzalloc where possible

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r 796ac2386a24 -r 56ec142bdd91 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Thu Mar 16 18:36:28 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Fri Mar 17 09:52:05 2006
@@ -116,15 +116,13 @@
                         const struct xenbus_device_id *id)
 {
        int err;
-       struct backend_info *be = kmalloc(sizeof(struct backend_info),
+       struct backend_info *be = kzalloc(sizeof(struct backend_info),
                                          GFP_KERNEL);
        if (!be) {
                xenbus_dev_fatal(dev, -ENOMEM,
                                 "allocating backend structure");
                return -ENOMEM;
        }
-       memset(be, 0, sizeof(*be));
-
        be->dev = dev;
        dev->data = be;
 
diff -r 796ac2386a24 -r 56ec142bdd91 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Thu Mar 16 
18:36:28 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Mar 17 
09:52:05 2006
@@ -90,13 +90,12 @@
                return err;
        }
 
-       info = kmalloc(sizeof(*info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info) {
                xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure");
                return -ENOMEM;
        }
 
-       memset(info, 0, sizeof(*info));
        info->xbdev = dev;
        info->vdevice = vdevice;
        info->connected = BLKIF_STATE_DISCONNECTED;
diff -r 796ac2386a24 -r 56ec142bdd91 
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Thu Mar 16 18:36:28 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Fri Mar 17 09:52:05 2006
@@ -97,11 +97,9 @@
 {
        struct xlbd_major_info *ptr;
 
-       ptr = kmalloc(sizeof(struct xlbd_major_info), GFP_KERNEL);
+       ptr = kzalloc(sizeof(struct xlbd_major_info), GFP_KERNEL);
        if (ptr == NULL)
                return NULL;
-
-       memset(ptr, 0, sizeof(struct xlbd_major_info));
 
        ptr->major = major;
 
diff -r 796ac2386a24 -r 56ec142bdd91 
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Thu Mar 16 18:36:28 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Fri Mar 17 09:52:05 2006
@@ -141,12 +141,11 @@
        char *frontend;
        int err;
 
-       be = kmalloc(sizeof(*be), GFP_KERNEL);
+       be = kzalloc(sizeof(*be), GFP_KERNEL);
        if (!be) {
                xenbus_dev_error(dev, -ENOMEM, "allocating backend structure");
                return -ENOMEM;
        }
-       memset(be, 0, sizeof(*be));
 
        frontend = NULL;
        err = xenbus_gather(dev->nodename,
diff -r 796ac2386a24 -r 56ec142bdd91 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Thu Mar 16 18:36:28 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Fri Mar 17 09:52:05 2006
@@ -76,14 +76,13 @@
                         const struct xenbus_device_id *id)
 {
        int err;
-       struct backend_info *be = kmalloc(sizeof(struct backend_info),
+       struct backend_info *be = kzalloc(sizeof(struct backend_info),
                                          GFP_KERNEL);
        if (!be) {
                xenbus_dev_fatal(dev, -ENOMEM,
                                 "allocating backend structure");
                return -ENOMEM;
        }
-       memset(be, 0, sizeof(*be));
 
        be->dev = dev;
        dev->data = be;
diff -r 796ac2386a24 -r 56ec142bdd91 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Thu Mar 16 18:36:28 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Fri Mar 17 09:52:05 2006
@@ -67,7 +67,7 @@
                          const struct xenbus_device_id *id)
 {
        int err;
-       struct backend_info *be = kmalloc(sizeof(struct backend_info),
+       struct backend_info *be = kzalloc(sizeof(struct backend_info),
                                          GFP_KERNEL);
 
        if (!be) {
@@ -75,8 +75,6 @@
                                 "allocating backend structure");
                return -ENOMEM;
        }
-
-       memset(be, 0, sizeof(*be));
 
        be->is_instance_set = 0;
        be->dev = dev;
diff -r 796ac2386a24 -r 56ec142bdd91 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Thu Mar 16 
18:36:28 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Fri Mar 17 
09:52:05 2006
@@ -179,11 +179,10 @@
 
        nonseekable_open(inode, filp);
 
-       u = kmalloc(sizeof(*u), GFP_KERNEL);
+       u = kzalloc(sizeof(*u), GFP_KERNEL);
        if (u == NULL)
                return -ENOMEM;
 
-       memset(u, 0, sizeof(*u));
        INIT_LIST_HEAD(&u->transactions);
        init_waitqueue_head(&u->read_waitq);
 
diff -r 796ac2386a24 -r 56ec142bdd91 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Thu Mar 16 
18:36:28 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Mar 17 
09:52:05 2006
@@ -552,10 +552,9 @@
        }
 
        stringlen = strlen(nodename) + 1 + strlen(type) + 1;
-       xendev = kmalloc(sizeof(*xendev) + stringlen, GFP_KERNEL);
+       xendev = kzalloc(sizeof(*xendev) + stringlen, GFP_KERNEL);
        if (!xendev)
                return -ENOMEM;
-       memset(xendev, 0, sizeof(*xendev));
 
        /* Copy the strings into the extra space. */
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Substitute kmalloc+memset by kzalloc where possible, Xen patchbot -unstable <=