summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLaura Abbott <labbott@redhat.com>2018-04-11 04:04:12 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-23 14:31:27 +0300
commitc13884a8da42222cf3ac11516e636bf6c271ba8d (patch)
tree9978dedcb0100f8ae90f95f96479a8e8bf31d9b6 /drivers
parent9b85e95a30801ed39ccbab167831ea5d40373f26 (diff)
downloadlinux-c13884a8da42222cf3ac11516e636bf6c271ba8d.tar.xz
misc: tifm: Remove VLA
There's an ongoing effort to remove VLAs[1] from the kernel to eventually turn on -Wvla. The single VLA can either take a value of 2 or 4 so switch to the upper bound. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Laura Abbott <labbott@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/tifm_7xx1.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index e5f108713dd8..9ac95b48ef92 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -239,9 +239,13 @@ static int tifm_7xx1_resume(struct pci_dev *dev)
unsigned long timeout;
unsigned int good_sockets = 0, bad_sockets = 0;
unsigned long flags;
- unsigned char new_ids[fm->num_sockets];
+ /* Maximum number of entries is 4 */
+ unsigned char new_ids[4];
DECLARE_COMPLETION_ONSTACK(finish_resume);
+ if (WARN_ON(fm->num_sockets > ARRAY_SIZE(new_ids)))
+ return -ENXIO;
+
pci_set_power_state(dev, PCI_D0);
pci_restore_state(dev);
rc = pci_enable_device(dev);