From patchwork Wed Jun 22 12:37:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9192659 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 6ED706075A for ; Wed, 22 Jun 2016 12:39:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EE36283E9 for ; Wed, 22 Jun 2016 12:39:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5309128406; Wed, 22 Jun 2016 12:39:16 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDBBC28404 for ; Wed, 22 Jun 2016 12:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752765AbcFVMjN (ORCPT ); Wed, 22 Jun 2016 08:39:13 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:61085 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752686AbcFVMjK (ORCPT ); Wed, 22 Jun 2016 08:39:10 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue001) with ESMTPA (Nemesis) id 0MazIw-1avQPx21t4-00KSFP; Wed, 22 Jun 2016 14:36:19 +0200 From: Arnd Bergmann To: Tomi Valkeinen Cc: Arnd Bergmann , Jean-Christophe Plagniol-Villard , Ingo Molnar , "Luis R. Rodriguez" , Borislav Petkov , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] fbdev: atyfb: fix array overflow Date: Wed, 22 Jun 2016 14:37:11 +0200 Message-Id: <20160622123822.1262383-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Y769rG3LQNy2KgCDslaeJa3vP7GlwwydRRzxwAT7iQWBuidtbD3 /iaFJu9hLTpR7O77/DR7wXFRWMf0bBXYxDlEmCjHEqK4IBhU/35nP2cAgoPZtVJtBBUzrYm l/gSy+SCu71cVsfbtpuw6QT91acPucWSKafmiAKIyESF6MtpsHBX5B4oP3SePlBVJp2DgvI oezu2Kic5Ku3kPS/Ld90Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:cjuk2XiCXiw=:dhCuIhk4Xy9QwVHPBZ6B4+ OuoSesww7VIsbR1MyFsy6jP042V37e9geN7VgVoxFtHLNPa/J/vO6Q2OaCovssJBPhRHgANSO 4B//IXn8v+4pMBVYGpmLWT2Dp1OEFXEj/j2E1vbiCXf0ShtgrxeO7C4wWF1KO1t3lAKncfaUa BLn1xAwUXkghThahvOvpTQ5NQPQekJS43HonnpVuuuxcMVCT3UY/hQ3qV2CkDHlKOKQxjsiFD jpTS4bcw2PDvOhOYmo0Dc4PWGkVgZkwZG7taXgU13UNv5Pc9TxUN0TS/19J4OFZydkdFWqWnn /oGtiyMsuZyNyKvrkcKXwmL9EBzs6t56IGpN+aNd2RmD2pysh2Uo+dMPovFNLK+cNx39D0j5+ c1M++Dwu+A3l9SS1tqz8Xdqad5qBH9O5Rmp3AiGtxe9wvvN1PE8E54f7PlZICCrBHVWiFDwEs om2LbN2aQks+ZOpI/GkrNRQ40Eaf9UlChy4JHV0RzUJ5sRuwIS8QnH/wD4D0h3CvYu5weCFvO YtZfbYG4+1SJoP1vzBfmMjnSpts1asc6P6wsztx1pehDWTCznMZyJycQ2kB7GskND7ufi8+VS 9Z1Up2RJUU3W7qzxH14HwBBZAnZrQgseI38ZHyNMZUTrO28vRI3embJlGJk7D0pa1aRdK3JRe PZW0e757dSykZnQKd9BrjmVuSUOBWpRH6WgLhBedeJ/jg9BlnY4C0A88uiBNAhb2CENI= Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When building with CONFIG_UBSAN_SANITIZE_ALL on ARM, I get this gcc warning for atyfb: drivers/video/fbdev/aty/atyfb_base.c: In function 'aty_bl_update_status': drivers/video/fbdev/aty/atyfb_base.c:167:33: warning: array subscript is above array bounds [-Warray-bounds] drivers/video/fbdev/aty/atyfb_base.c:152:26: warning: array subscript is above array bounds [-Warray-bounds] Apparently the warning is correct and there is indeed an overflow, which was never caught. I could only reproduce this on ARM and have opened a bug against the compiler for the lack of warning. This patch makes the array larger, so we cover all possible registers in the LCD controller without an overflow. Signed-off-by: Arnd Bergmann Link: https://bugs.linaro.org/show_bug.cgi?id=2349 --- drivers/video/fbdev/aty/atyfb_base.c | 2 +- include/video/mach64.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index 001d3d871800..36ffba152eab 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -134,7 +134,7 @@ #if defined(CONFIG_PM) || defined(CONFIG_PMAC_BACKLIGHT) || \ defined (CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_FB_ATY_BACKLIGHT) -static const u32 lt_lcd_regs[] = { +static const u32 lt_lcd_regs[LCD_REG_NUM] = { CNFG_PANEL_LG, LCD_GEN_CNTL_LG, DSTN_CONTROL_LG, diff --git a/include/video/mach64.h b/include/video/mach64.h index 89e91c0cb737..9f74e9e0aeb8 100644 --- a/include/video/mach64.h +++ b/include/video/mach64.h @@ -1299,6 +1299,7 @@ #define APC_LUT_KL 0x38 #define APC_LUT_MN 0x39 #define APC_LUT_OP 0x3A +#define LCD_REG_NUM 0x3B /* total number */ /* Values in LCD_GEN_CTRL */ #define CRT_ON 0x00000001ul