From patchwork Fri Mar 9 05:50:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobin Harding X-Patchwork-Id: 10269739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0AD9B60236 for ; Fri, 9 Mar 2018 05:50:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E33B729D14 for ; Fri, 9 Mar 2018 05:50:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1DD629D17; Fri, 9 Mar 2018 05:50:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id A39E429D15 for ; Fri, 9 Mar 2018 05:50:55 +0000 (UTC) Received: (qmail 22288 invoked by uid 550); 9 Mar 2018 05:50:54 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 22246 invoked from network); 9 Mar 2018 05:50:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=cc :date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=jjXiikWiTPAfLSf0Cmrf9T6nnRljn7S8bHMaAchET PM=; b=D6WncTWJhcrI+y2r4NBv+3JgfskAcmcHWs4NlXbfP26SU1AP33kbt2Va0 AIe2oq9tZBkdHNnkoWVXAgosmPHWXGsL5lUZ5GihlTXzpatWvjNgYn4fDOtiZ5/L B1UmC8C5b1l1GGwmNtfX/r1onn+61Pds/VCRcM9dtFJnGb/C14wuC6mhIDCErbcE b2t3ZdWyLtG8eCbC61Pd3DD3uUg1USxJ+px6O4pxiLVBKYE0gYwiGlqolVOBZmmi Hgrn+khBu0iTaDPhbSPhY0ivn70FAbN9fGoo6PPTUFtTmS2MWCBW6DYzipXWbhTi ZYM3bPg/h8EfixmhiDyAZu2zC42lA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=jjXiikWiTPAfLSf0C mrf9T6nnRljn7S8bHMaAchETPM=; b=Jivmnu1GilzfVALUL5gxSWTVI7EukJg// GwfUeRomK8QdzlRH9jXeh36P9b57KqjO6zSbJtJl8uKd51wKd4RClPuTIBzftPJ3 Po8hefEa/Hywkw8mXIRHWimRsLmtd9S/G4qEes3LIHQYS9E4u2V25EwXRIDeznnB 5QOPfrsU9/fCXnFbP7gLjAdR8J/YV3pCtXCGTfQJO82s+bOeBs/VHuJj3uJlQy0x OSmlr0+mTw4B9VgAmoBggFS08PQH8+AM9RMkl8XXTdrlR71thk5FeU9Rv9NUT5Zb lEMtoHHRHZS2eNcHPLZgt2YBj9MMh24teIZXC2zHJfdQBmEKl/ngg== X-ME-Sender: From: "Tobin C. Harding" To: Florian Tobias Schandinat , Bartlomiej Zolnierkiewicz Cc: "Tobin C. Harding" , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, driverdev-devel@linuxdriverproject.org, Tycho Andersen , Kees Cook Subject: [PATCH 4/4] video: Remove stack VLA usage Date: Fri, 9 Mar 2018 16:50:25 +1100 Message-Id: <1520574625-4225-1-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP The kernel would like to have all stack VLA usage removed[1]. The arrays are fixed here (declared with a const variable) but they appear like VLAs to the compiler. We can use a pre-processor define to fix the warning. [1]: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Tobin C. Harding --- drivers/video/fbdev/via/via_aux_sii164.c | 8 +++++--- drivers/video/fbdev/via/via_aux_vt1631.c | 11 +++++++---- drivers/video/fbdev/via/via_aux_vt1632.c | 11 +++++++---- drivers/video/fbdev/via/via_aux_vt1636.c | 11 +++++++---- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/video/fbdev/via/via_aux_sii164.c b/drivers/video/fbdev/via/via_aux_sii164.c index ca1b35f033b1..f715ea4f466c 100644 --- a/drivers/video/fbdev/via/via_aux_sii164.c +++ b/drivers/video/fbdev/via/via_aux_sii164.c @@ -27,6 +27,9 @@ static const char *name = "SiI 164 PanelLink Transmitter"; +/* check vendor id and device id */ +const u8 id[] = {0x01, 0x00, 0x06, 0x00}; +#define VIA_SII164_LEN ARRAY_SIZE(id) static void probe(struct via_aux_bus *bus, u8 addr) { @@ -34,9 +37,8 @@ static void probe(struct via_aux_bus *bus, u8 addr) .bus = bus, .addr = addr, .name = name}; - /* check vendor id and device id */ - const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id); - u8 tmp[len]; + u8 tmp[VIA_SII164_LEN]; + int len = VIA_SII164_LEN; if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) return; diff --git a/drivers/video/fbdev/via/via_aux_vt1631.c b/drivers/video/fbdev/via/via_aux_vt1631.c index 06e742f1f723..5bfaa20ec5a8 100644 --- a/drivers/video/fbdev/via/via_aux_vt1631.c +++ b/drivers/video/fbdev/via/via_aux_vt1631.c @@ -27,16 +27,19 @@ static const char *name = "VT1631 LVDS Transmitter"; +/* check vendor id and device id */ +const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id); +#define VIA_VT1631_LEN ARRAY_SIZE(id) void via_aux_vt1631_probe(struct via_aux_bus *bus) { struct via_aux_drv drv = { .bus = bus, .addr = 0x38, - .name = name}; - /* check vendor id and device id */ - const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id); - u8 tmp[len]; + .name = name + }; + u8 tmp[VIA_VT1631_LEN]; + int len = VIA_VT1631_LEN; if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) return; diff --git a/drivers/video/fbdev/via/via_aux_vt1632.c b/drivers/video/fbdev/via/via_aux_vt1632.c index d24f4cd97401..fcddd761d4a4 100644 --- a/drivers/video/fbdev/via/via_aux_vt1632.c +++ b/drivers/video/fbdev/via/via_aux_vt1632.c @@ -27,16 +27,19 @@ static const char *name = "VT1632 DVI Transmitter"; +/* check vendor id and device id */ +const u8 id[] = {0x06, 0x11, 0x92, 0x31}; +#define VIA_VT1632_LEN ARRAY_SIZE(id) static void probe(struct via_aux_bus *bus, u8 addr) { struct via_aux_drv drv = { .bus = bus, .addr = addr, - .name = name}; - /* check vendor id and device id */ - const u8 id[] = {0x06, 0x11, 0x92, 0x31}, len = ARRAY_SIZE(id); - u8 tmp[len]; + .name = name + }; + u8 tmp[VIA_VT1632_LEN]; + int len = VIA_VT1632_LEN; if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) return; diff --git a/drivers/video/fbdev/via/via_aux_vt1636.c b/drivers/video/fbdev/via/via_aux_vt1636.c index 9e015c101d4d..49c9269c7f81 100644 --- a/drivers/video/fbdev/via/via_aux_vt1636.c +++ b/drivers/video/fbdev/via/via_aux_vt1636.c @@ -27,16 +27,19 @@ static const char *name = "VT1636 LVDS Transmitter"; +/* check vendor id and device id */ +const u8 id[] = {0x06, 0x11, 0x45, 0x33}; +#define VIA_VT1636_LEN ARRAY_SIZE(id) void via_aux_vt1636_probe(struct via_aux_bus *bus) { struct via_aux_drv drv = { .bus = bus, .addr = 0x40, - .name = name}; - /* check vendor id and device id */ - const u8 id[] = {0x06, 0x11, 0x45, 0x33}, len = ARRAY_SIZE(id); - u8 tmp[len]; + .name = name + }; + u8 tmp[VIA_VT1636_LEN]; + int len = VIA_VT1636_LEN; if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) return;