Skip to content

Commit

Permalink
Staging: unisys: virthba: Fix variable length array
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ken Cox authored and Greg Kroah-Hartman committed Mar 9, 2014
1 parent a16a027 commit bed3b10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/staging/unisys/virthba/virthba.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit bed3b10

Please sign in to comment.