From: Dan Carpenter Date: Thu, 22 Oct 2015 19:51:27 +0000 (+0300) Subject: mailbox: Off by one in mbox_test_message_read() X-Git-Tag: firefly_0821_release~176^2~767^2~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c3ac54a6f554475b034f87d471417bf0afcf3a42;p=firefly-linux-kernel-4.4.55.git mailbox: Off by one in mbox_test_message_read() We need to leave space for the NUL char. Fixes: 8ea4484d0c2b ('mailbox: Add generic mechanism for testing Mailbox Controllers') Signed-off-by: Dan Carpenter --- diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c index a4f10cc4aea3..f82dc8926687 100644 --- a/drivers/mailbox/mailbox-test.c +++ b/drivers/mailbox/mailbox-test.c @@ -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;