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: 102119 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2526986qgy; Wed, 22 Jun 2016 05:39:25 -0700 (PDT) X-Received: by 10.98.22.198 with SMTP id 189mr34467254pfw.74.1466599159021; Wed, 22 Jun 2016 05:39:19 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si46824282pfa.18.2016.06.22.05.39.18; Wed, 22 Jun 2016 05:39:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-fbdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-fbdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-fbdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752765AbcFVMjN (ORCPT + 2 others); 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 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(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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