ARM: mv78xx0: fix possible PCI buffer overflow
authorArnd Bergmann <arnd@arndb.de>
Wed, 11 Jan 2017 13:41:40 +0000 (14:41 +0100)
committerGregory CLEMENT <gregory.clement@free-electrons.com>
Fri, 27 Jan 2017 16:52:57 +0000 (17:52 +0100)
gcc-7.0 reports a potential array overflow:

arch/arm/mach-mv78xx0/pcie.c: In function 'mv78xx0_pcie_preinit':
arch/arm/mach-mv78xx0/pcie.c:81:4: error: output may be truncated before the last format character [-Werror=format-truncation=]

I haven't checked if this can actually happen, but making the
array one 32-bit word longer addresses the warning and makes
it completely safe.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
arch/arm/mach-mv78xx0/pcie.c

index 13a7d72ee0c4b428ae526ea16c64d2007a01f93c..81ff4327a96296c25a68b83694dfe2259f100347 100644 (file)
@@ -29,7 +29,7 @@ struct pcie_port {
        u8                      root_bus_nr;
        void __iomem            *base;
        spinlock_t              conf_lock;
-       char                    mem_space_name[16];
+       char                    mem_space_name[20];
        struct resource         res;
 };