From: Wei Yongjun Date: Sat, 23 Mar 2013 07:04:14 +0000 (+0800) Subject: mailbox: fix invalid use of sizeof in mailbox_msg_send() X-Git-Tag: next-20130327~16^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c497eba5247728c67ba0e0de0907723dd114134a;p=karo-tx-linux.git mailbox: fix invalid use of sizeof in mailbox_msg_send() sizeof() when applied to a pointer typed expression gives the size of the pointer, not that of the pointed data. Signed-off-by: Wei Yongjun Signed-off-by: Suman Anna --- diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 5fea5c276a61..78e52c064270 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -83,7 +83,7 @@ int mailbox_msg_send(struct mailbox *mbox, struct mailbox_msg *msg) mutex_lock(&mq->mlock); - if (kfifo_avail(&mq->fifo) < (sizeof(msg) + msg->size)) { + if (kfifo_avail(&mq->fifo) < (sizeof(*msg) + msg->size)) { ret = -ENOMEM; goto out; } @@ -93,8 +93,8 @@ int mailbox_msg_send(struct mailbox *mbox, struct mailbox_msg *msg) goto out; } - len = kfifo_in(&mq->fifo, (unsigned char *)msg, sizeof(msg)); - WARN_ON(len != sizeof(msg)); + len = kfifo_in(&mq->fifo, (unsigned char *)msg, sizeof(*msg)); + WARN_ON(len != sizeof(*msg)); if (msg->size && msg->pdata) { len = kfifo_in(&mq->fifo, (unsigned char *)msg->pdata,