summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2017-03-20 15:04:05 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-08 17:38:25 +0200
commitdd04eecc41ae7cf139593b400e74defad62cec54 (patch)
treeaf56e3cbffa0576dc64948353753a61b6a62bd30 /drivers/misc
parent3fcbab6c4a962259b8cb83aea813a4c7fbe11f77 (diff)
downloadlinux-dd04eecc41ae7cf139593b400e74defad62cec54.tar.gz
linux-dd04eecc41ae7cf139593b400e74defad62cec54.tar.bz2
linux-dd04eecc41ae7cf139593b400e74defad62cec54.zip
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: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/bus-fixup.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index 29f2daed37e0..0208c4b027c5 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -110,12 +110,13 @@ struct mkhi_msg {
u8 data[0];
} __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)
{
- const size_t size = sizeof(struct mkhi_msg_hdr) +
- sizeof(struct mkhi_fwcaps) +
- sizeof(struct mei_os_ver);
- char buf[size];
+ const size_t size = MKHI_OSVER_BUF_LEN;
+ char buf[MKHI_OSVER_BUF_LEN];
struct mkhi_msg *req;
struct mkhi_fwcaps *fwcaps;
struct mei_os_ver *os_ver;