]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ipc-mqueue-strengthen-checks-on-mqueue-creation-fix
authorAndrew Morton <akpm@linux-foundation.org>
Thu, 3 May 2012 05:44:53 +0000 (15:44 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 3 May 2012 05:47:02 +0000 (15:47 +1000)
s/ENOMEM/EOVERFLOW/

Cc: Doug Ledford <dledford@redhat.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
ipc/mqueue.c

index b0461f8459b7f04886ca189f8da5f0d8a2b07522..62a5bbbea7ea50ce18edf5960f0934e93eed285c 100644 (file)
@@ -687,13 +687,13 @@ static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
        }
        /* check for overflow */
        if (attr->mq_msgsize > ULONG_MAX/attr->mq_maxmsg)
-               return -ENOMEM;
+               return -EOVERFLOW;
        mq_treesize = attr->mq_maxmsg * sizeof(struct msg_msg) +
                min_t(unsigned int, attr->mq_maxmsg, MQ_PRIO_MAX) *
                sizeof(struct posix_msg_tree_node);
        total_size = attr->mq_maxmsg * attr->mq_msgsize;
        if (total_size + mq_treesize < total_size)
-               return -ENOMEM;
+               return -EOVERFLOW;
        return 0;
 }