Commit dd04eecc authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: bus: elminate variable length arrays

Though VLA are supported by CC99 there are many cavities
and should be avoided.

'const size_t len = sizeof()' that we used may not be set
at the compile time hence generating VLA code.

This fixes also sparse warning
warning: Variable length array is used type.
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3fcbab6c
...@@ -110,12 +110,13 @@ struct mkhi_msg { ...@@ -110,12 +110,13 @@ struct mkhi_msg {
u8 data[0]; u8 data[0];
} __packed; } __packed;
#define MKHI_OSVER_BUF_LEN (sizeof(struct mkhi_msg_hdr) + \
sizeof(struct mkhi_fwcaps) + \
sizeof(struct mei_os_ver))
static int mei_osver(struct mei_cl_device *cldev) static int mei_osver(struct mei_cl_device *cldev)
{ {
const size_t size = sizeof(struct mkhi_msg_hdr) + const size_t size = MKHI_OSVER_BUF_LEN;
sizeof(struct mkhi_fwcaps) + char buf[MKHI_OSVER_BUF_LEN];
sizeof(struct mei_os_ver);
char buf[size];
struct mkhi_msg *req; struct mkhi_msg *req;
struct mkhi_fwcaps *fwcaps; struct mkhi_fwcaps *fwcaps;
struct mei_os_ver *os_ver; struct mei_os_ver *os_ver;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment