summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys
diff options
context:
space:
mode:
authorKen Cox2014-03-07 17:30:27 +0100
committerGreg Kroah-Hartman2014-03-09 07:42:14 +0100
commitbed3b10d20e34683ddc596f7858fef076d148390 (patch)
tree776bd9c30f795947fd873056ab5b3a76f05e0b46 /drivers/staging/unisys
parentstaging: unisys/uislib: kthread_create() returns an ERR_PTR (diff)
downloadkernel-qcow2-linux-bed3b10d20e34683ddc596f7858fef076d148390.tar.gz
kernel-qcow2-linux-bed3b10d20e34683ddc596f7858fef076d148390.tar.xz
kernel-qcow2-linux-bed3b10d20e34683ddc596f7858fef076d148390.zip
Staging: unisys: virthba: Fix variable length array
A character array was declared on the stack with variable length. This has been corrected to use a fixed length. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ken Cox <jkc@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys')
-rw-r--r--drivers/staging/unisys/virthba/virthba.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c
index c292293718f0..277851fff443 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -1439,12 +1439,15 @@ static ssize_t
enable_ints_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
- char buf[count + 1];
+ char buf[4];
int i, new_value;
struct virthba_info *virthbainfo;
U64 *Features_addr;
U64 mask;
+ if (count >= ARRAY_SIZE(buf))
+ return -EINVAL;
+
buf[count] = '\0';
if (copy_from_user(buf, buffer, count)) {
LOGERR("copy_from_user failed. buf<<%.*s>> count<<%lu>>\n",