The patch titled mqueue: remove unneeded info->messages initialization has been added to the -mm tree. Its filename is mqueue-remove-unneeded-info-messages-initialization.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: mqueue: remove unneeded info->messages initialization From: André Goddard Rosa <andre.goddard@xxxxxxxxx> ... and abort earlier if we couldn't allocate the message pointers array, avoiding the u->mq_bytes accounting logic. It reduces code size: text data bss dec hex filename 9949 72 16 10037 2735 ipc/mqueue-BEFORE.o 9941 72 16 10029 272d ipc/mqueue-AFTER.o Signed-off-by: André Goddard Rosa <andre.goddard@xxxxxxxxx> Cc: Serge E. Hallyn <serue@xxxxxxxxxx> Cc: Cedric Le Goater <clg@xxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- ipc/mqueue.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff -puN ipc/mqueue.c~mqueue-remove-unneeded-info-messages-initialization ipc/mqueue.c --- a/ipc/mqueue.c~mqueue-remove-unneeded-info-messages-initialization +++ a/ipc/mqueue.c @@ -134,7 +134,6 @@ static struct inode *mqueue_get_inode(st init_waitqueue_head(&info->wait_q); INIT_LIST_HEAD(&info->e_wait_q[0].list); INIT_LIST_HEAD(&info->e_wait_q[1].list); - info->messages = NULL; info->notify_owner = NULL; info->qsize = 0; info->user = NULL; /* set when all is ok */ @@ -146,6 +145,10 @@ static struct inode *mqueue_get_inode(st info->attr.mq_msgsize = attr->mq_msgsize; } mq_msg_tblsz = info->attr.mq_maxmsg * sizeof(struct msg_msg *); + info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL); + if (!info->messages) + goto out_inode; + mq_bytes = (mq_msg_tblsz + (info->attr.mq_maxmsg * info->attr.mq_msgsize)); @@ -154,18 +157,12 @@ static struct inode *mqueue_get_inode(st u->mq_bytes + mq_bytes > p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur) { spin_unlock(&mq_lock); + kfree(info->messages); goto out_inode; } u->mq_bytes += mq_bytes; spin_unlock(&mq_lock); - info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL); - if (!info->messages) { - spin_lock(&mq_lock); - u->mq_bytes -= mq_bytes; - spin_unlock(&mq_lock); - goto out_inode; - } /* all is ok */ info->user = get_uid(u); } else if (S_ISDIR(mode)) { _ Patches currently in -mm which might be from andre.goddard@xxxxxxxxx are linux-next.patch mqueue-fix-mq_open-file-descriptor-leak-on-user-space-processes.patch mqueue-remove-unneeded-info-messages-initialization.patch mqueue-apply-mathematics-distributivity-on-mq_bytes-calculation.patch mqueue-simplify-do_open-error-handling.patch mqueue-only-set-error-codes-if-they-are-really-necessary.patch mqueue-fix-typo-failues-failures.patch lib-stringc-simplify-stricmp.patch lib-stringc-simplify-strnstr.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html