提交 bed3b10d 编写于 作者: K Ken Cox 提交者: Greg Kroah-Hartman

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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NKen Cox <jkc@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a16a0276
...@@ -1439,12 +1439,15 @@ static ssize_t ...@@ -1439,12 +1439,15 @@ static ssize_t
enable_ints_write(struct file *file, const char __user *buffer, enable_ints_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
char buf[count + 1]; char buf[4];
int i, new_value; int i, new_value;
struct virthba_info *virthbainfo; struct virthba_info *virthbainfo;
U64 *Features_addr; U64 *Features_addr;
U64 mask; U64 mask;
if (count >= ARRAY_SIZE(buf))
return -EINVAL;
buf[count] = '\0'; buf[count] = '\0';
if (copy_from_user(buf, buffer, count)) { if (copy_from_user(buf, buffer, count)) {
LOGERR("copy_from_user failed. buf<<%.*s>> count<<%lu>>\n", LOGERR("copy_from_user failed. buf<<%.*s>> count<<%lu>>\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册