]> Git Repo - linux.git/commitdiff
mailbox: Off by one in mbox_test_message_read()
authorDan Carpenter <[email protected]>
Thu, 22 Oct 2015 19:51:27 +0000 (22:51 +0300)
committerJassi Brar <[email protected]>
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 <[email protected]>
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;
 
This page took 0.056697 seconds and 4 git commands to generate.