aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipc/mqueue.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 3660c334ee6b..15eabf9d51fd 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -261,8 +261,9 @@ static void mqueue_delete_inode(struct inode *inode)
261 261
262 clear_inode(inode); 262 clear_inode(inode);
263 263
264 mq_bytes = (info->attr.mq_maxmsg * sizeof(struct msg_msg *) + 264 /* Total amount of bytes accounted for the mqueue */
265 (info->attr.mq_maxmsg * info->attr.mq_msgsize)); 265 mq_bytes = info->attr.mq_maxmsg * (sizeof(struct msg_msg *)
266 + info->attr.mq_msgsize);
266 user = info->user; 267 user = info->user;
267 if (user) { 268 if (user) {
268 spin_lock(&mq_lock); 269 spin_lock(&mq_lock);
@@ -601,8 +602,8 @@ static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
601 /* check for overflow */ 602 /* check for overflow */
602 if (attr->mq_msgsize > ULONG_MAX/attr->mq_maxmsg) 603 if (attr->mq_msgsize > ULONG_MAX/attr->mq_maxmsg)
603 return 0; 604 return 0;
604 if ((unsigned long)(attr->mq_maxmsg * attr->mq_msgsize) + 605 if ((unsigned long)(attr->mq_maxmsg * (attr->mq_msgsize
605 (attr->mq_maxmsg * sizeof (struct msg_msg *)) < 606 + sizeof (struct msg_msg *))) <
606 (unsigned long)(attr->mq_maxmsg * attr->mq_msgsize)) 607 (unsigned long)(attr->mq_maxmsg * attr->mq_msgsize))
607 return 0; 608 return 0;
608 return 1; 609 return 1;