* [PATCH 1/2] Conversions from kmalloc+memset to k(z|c)alloc
@ 2006-07-19 1:31 Panagiotis Issaris
2006-07-19 6:23 ` Rolf Eike Beer
0 siblings, 1 reply; 2+ messages in thread
From: Panagiotis Issaris @ 2006-07-19 1:31 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-eata
From: Panagiotis Issaris <takis@issaris.org>
Conversions from kmalloc+memset to kzalloc.
Signed-off-by: Panagiotis Issaris <takis@issaris.org>
---
Applies to current GIT or 2.6.18-rc2. Compile-tested with
make allyesconfig.
drivers/scsi/ide-scsi.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index f9e913f..57f460e 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -326,17 +326,15 @@ static int idescsi_check_condition(ide_d
u8 *buf;
/* stuff a sense request in front of our current request */
- pc = kmalloc (sizeof (idescsi_pc_t), GFP_ATOMIC);
+ pc = kzalloc (sizeof (idescsi_pc_t), GFP_ATOMIC);
rq = kmalloc (sizeof (struct request), GFP_ATOMIC);
- buf = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC);
+ buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC);
if (pc == NULL || rq == NULL || buf == NULL) {
kfree(buf);
kfree(rq);
kfree(pc);
return -ENOMEM;
}
- memset (pc, 0, sizeof (idescsi_pc_t));
- memset (buf, 0, SCSI_SENSE_BUFFERSIZE);
ide_init_drive_cmd(rq);
rq->special = (char *) pc;
pc->rq = rq;
--
1.4.1.gd3ba6
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/2] Conversions from kmalloc+memset to k(z|c)alloc
2006-07-19 1:31 [PATCH 1/2] Conversions from kmalloc+memset to k(z|c)alloc Panagiotis Issaris
@ 2006-07-19 6:23 ` Rolf Eike Beer
0 siblings, 0 replies; 2+ messages in thread
From: Rolf Eike Beer @ 2006-07-19 6:23 UTC (permalink / raw)
To: Panagiotis Issaris, linux-scsi; +Cc: linux-kernel, linux-eata
Added linux-scsi to CC as it touches drivers/scsi/
> /* stuff a sense request in front of our current request */
> - pc = kmalloc (sizeof (idescsi_pc_t), GFP_ATOMIC);
> + pc = kzalloc (sizeof (idescsi_pc_t), GFP_ATOMIC);
Please remove the space before the arguments.
> rq = kmalloc (sizeof (struct request), GFP_ATOMIC);
This and the one before should be "rq = kzalloc(sizeof(*rq),...);" This way
you will always get the correct buffer size even if the type of rq changes.
Eike
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-07-19 6:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-19 1:31 [PATCH 1/2] Conversions from kmalloc+memset to k(z|c)alloc Panagiotis Issaris
2006-07-19 6:23 ` Rolf Eike Beer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox