From: Duncan Sands <baldrick@free.fr>
To: Greg KH <greg@kroah.com>
Cc: usbatm@lists.infradead.org,
linux-usb-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: [PATCH 04/13] USBATM: kzalloc conversion
Date: Fri, 13 Jan 2006 09:38:22 +0100 [thread overview]
Message-ID: <200601130938.22715.baldrick@free.fr> (raw)
In-Reply-To: <200601121729.52596.baldrick@free.fr>
[-- Attachment #1: Type: text/plain, Size: 85 bytes --]
Convert kmalloc + memset to kzalloc.
Signed-off-by: Duncan Sands <baldrick@free.fr>
[-- Attachment #2: 04-kzalloc --]
[-- Type: text/x-diff, Size: 2572 bytes --]
Index: Linux/drivers/usb/atm/cxacru.c
===================================================================
--- Linux.orig/drivers/usb/atm/cxacru.c 2006-01-13 08:48:09.000000000 +0100
+++ Linux/drivers/usb/atm/cxacru.c 2006-01-13 08:51:00.000000000 +0100
@@ -673,14 +673,12 @@
int ret;
/* instance init */
- instance = kmalloc(sizeof(*instance), GFP_KERNEL);
+ instance = kzalloc(sizeof(*instance), GFP_KERNEL);
if (!instance) {
dbg("cxacru_bind: no memory for instance data");
return -ENOMEM;
}
- memset(instance, 0, sizeof(*instance));
-
instance->usbatm = usbatm_instance;
instance->modem_type = (struct cxacru_modem_type *) id->driver_info;
Index: Linux/drivers/usb/atm/speedtch.c
===================================================================
--- Linux.orig/drivers/usb/atm/speedtch.c 2006-01-13 08:48:09.000000000 +0100
+++ Linux/drivers/usb/atm/speedtch.c 2006-01-13 08:51:00.000000000 +0100
@@ -715,7 +715,7 @@
}
}
- instance = kmalloc(sizeof(*instance), GFP_KERNEL);
+ instance = kzalloc(sizeof(*instance), GFP_KERNEL);
if (!instance) {
usb_err(usbatm, "%s: no memory for instance data!\n", __func__);
@@ -723,8 +723,6 @@
goto fail_release;
}
- memset(instance, 0, sizeof(struct speedtch_instance_data));
-
instance->usbatm = usbatm;
INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance);
Index: Linux/drivers/usb/atm/usbatm.c
===================================================================
--- Linux.orig/drivers/usb/atm/usbatm.c 2006-01-13 08:46:17.000000000 +0100
+++ Linux/drivers/usb/atm/usbatm.c 2006-01-13 08:51:00.000000000 +0100
@@ -763,13 +763,12 @@
goto fail;
}
- if (!(new = kmalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) {
+ if (!(new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) {
atm_err(instance, "%s: no memory for vcc_data!\n", __func__);
ret = -ENOMEM;
goto fail;
}
- memset(new, 0, sizeof(struct usbatm_vcc_data));
new->vcc = vcc;
new->vpi = vpi;
new->vci = vci;
@@ -1066,13 +1065,12 @@
instance->urbs[i] = urb;
- buffer = kmalloc(channel->buf_size, GFP_KERNEL);
+ /* zero the tx padding to avoid leaking information */
+ buffer = kzalloc(channel->buf_size, GFP_KERNEL);
if (!buffer) {
dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i);
goto fail_unbind;
}
- /* zero the tx padding to avoid leaking information */
- memset(buffer, 0, channel->buf_size);
usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint,
buffer, channel->buf_size, usbatm_complete, channel);
next prev parent reply other threads:[~2006-01-13 8:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-12 16:29 [PATCH 00/13] USBATM: summary Duncan Sands
2006-01-12 16:43 ` [PATCH 01/13] USBATM: trivial modifications Duncan Sands
2006-01-12 17:40 ` Duncan Sands
2006-01-12 17:48 ` [PATCH 02/13] USBATM: add flags field Duncan Sands
2006-01-12 18:30 ` [PATCH 00/13] USBATM: summary Greg KH
2006-01-12 19:15 ` Duncan Sands
2006-01-13 10:30 ` [linux-usb-devel] " Duncan Sands
2006-01-13 8:36 ` [PATCH 03/13] USBATM: remove .owner Duncan Sands
2006-01-13 8:38 ` Duncan Sands [this message]
2006-01-13 8:48 ` [PATCH 05/13] USBATM: xusbatm rewrite Duncan Sands
2006-01-13 9:05 ` [PATCH 06/13] USBATM: shutdown open connections when disconnected Duncan Sands
2006-08-18 19:40 ` R: " Giampaolo Tomassoni
2006-01-13 9:07 ` [PATCH 07/13] USBATM: return correct error code when out of memory Duncan Sands
2006-01-13 9:13 ` [PATCH 08/13] USBATM: use dev_kfree_skb_any rather than dev_kfree_skb Duncan Sands
2006-01-13 9:52 ` [PATCH 09/13] USBATM: measure buffer size in bytes; force valid sizes Duncan Sands
2006-01-13 9:59 ` [PATCH 10/13] USBATM: allow isochronous transfer Duncan Sands
2006-01-13 10:06 ` [PATCH 11/13] USBATM: handle urbs containing partial cells Duncan Sands
2006-01-13 10:08 ` [PATCH 12/13] USBATM: bump version numbers Duncan Sands
2006-01-13 10:12 ` [PATCH 13/13] USBATM: -EILSEQ workaround Duncan Sands
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200601130938.22715.baldrick@free.fr \
--to=baldrick@free.fr \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=usbatm@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®