From: Matt Helsley Date: Mon, 2 Oct 2006 09:18:25 +0000 (-0700) Subject: [PATCH] ipc: replace kmalloc and memset in get_undo_list with kzalloc X-Git-Tag: v2.6.19-rc1~399 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=sidebyside;h=2453a3062d36f39f01302f9f1ad18e7a0c54fe38;p=powerpc.git [PATCH] ipc: replace kmalloc and memset in get_undo_list with kzalloc Simplify get_undo_list() by dropping the unnecessary cast, removing the size variable, and switching to kzalloc() instead of a kmalloc() followed by a memset(). This cleanup was split then modified from Jes Sorenson's Task Notifiers patches. Signed-off-by: Matt Helsley Cc: Jes Sorensen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/ipc/sem.c b/ipc/sem.c index 69edeb1e2a..0dafcc455f 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1003,15 +1003,12 @@ static inline void unlock_semundo(void) static inline int get_undo_list(struct sem_undo_list **undo_listp) { struct sem_undo_list *undo_list; - int size; undo_list = current->sysvsem.undo_list; if (!undo_list) { - size = sizeof(struct sem_undo_list); - undo_list = (struct sem_undo_list *) kmalloc(size, GFP_KERNEL); + undo_list = kzalloc(sizeof(*undo_list), GFP_KERNEL); if (undo_list == NULL) return -ENOMEM; - memset(undo_list, 0, size); spin_lock_init(&undo_list->lock); atomic_set(&undo_list->refcnt, 1); current->sysvsem.undo_list = undo_list;