mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ipc:  Convert kmalloc()+memset() to kzalloc() in ipc/.
@ 2006-12-03 17:14 Robert P. J. Day
  2006-12-03 17:42 ` Jan Engelhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2006-12-03 17:14 UTC (permalink / raw)
  To: Linux kernel mailing list


  Convert the single changeable instance of kmalloc() + memset() to
kzalloc() in the ipc/ directory.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>

---

  ok, i *think* this one's valid.  now i'll go work on something else.

diff --git a/ipc/sem.c b/ipc/sem.c
index 21b3289..3c23dc9 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1070,14 +1070,13 @@ static struct sem_undo *find_undo(struct
 	ipc_rcu_getref(sma);
 	sem_unlock(sma);

-	new = (struct sem_undo *) kmalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL);
+	new = (struct sem_undo *) kzalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL);
 	if (!new) {
 		ipc_lock_by_ptr(&sma->sem_perm);
 		ipc_rcu_putref(sma);
 		sem_unlock(sma);
 		return ERR_PTR(-ENOMEM);
 	}
-	memset(new, 0, sizeof(struct sem_undo) + sizeof(short)*nsems);
 	new->semadj = (short *) &new[1];
 	new->semid = semid;


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

* Re: [PATCH] ipc:  Convert kmalloc()+memset() to kzalloc() in ipc/.
  2006-12-03 17:14 [PATCH] ipc: Convert kmalloc()+memset() to kzalloc() in ipc/ Robert P. J. Day
@ 2006-12-03 17:42 ` Jan Engelhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Engelhardt @ 2006-12-03 17:42 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux kernel mailing list


>diff --git a/ipc/sem.c b/ipc/sem.c
>index 21b3289..3c23dc9 100644
>--- a/ipc/sem.c
>+++ b/ipc/sem.c
>@@ -1070,14 +1070,13 @@ static struct sem_undo *find_undo(struct
> 	ipc_rcu_getref(sma);
> 	sem_unlock(sma);
>
>-	new = (struct sem_undo *) kmalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL);
>+	new = (struct sem_undo *) kzalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL);

You can drop the case in one go.



	-`J'
-- 

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

end of thread, other threads:[~2006-12-03 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-03 17:14 [PATCH] ipc: Convert kmalloc()+memset() to kzalloc() in ipc/ Robert P. J. Day
2006-12-03 17:42 ` Jan Engelhardt

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®