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 <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Suman Anna <s-anna@ti.com>
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;
}
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,