mailbox: Off by one in mbox_test_message_read()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 22 Oct 2015 19:51:27 +0000 (22:51 +0300)
committerJassi Brar <jaswinder.singh@linaro.org>
Tue, 27 Oct 2015 15:57:25 +0000 (21:27 +0530)
We need to leave space for the NUL char.

Fixes: 8ea4484d0c2b ('mailbox: Add generic mechanism for testing Mailbox Controllers')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
drivers/mailbox/mailbox-test.c

index a4f10cc4aea3f5b5f17648486c709f3be5a0343d..f82dc89266879b4dca394e574be4dbc382a1f0e1 100644 (file)
@@ -143,7 +143,7 @@ static ssize_t mbox_test_message_read(struct file *filp, char __user *userbuf,
        int l = 0;
        int ret;
 
-       touser = kzalloc(MBOX_HEXDUMP_MAX_LEN, GFP_KERNEL);
+       touser = kzalloc(MBOX_HEXDUMP_MAX_LEN + 1, GFP_KERNEL);
        if (!touser)
                return -ENOMEM;