Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp744469pxf; Wed, 24 Mar 2021 15:06:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtpD3tVA+J52A/Zo/ihjXReJPzAhHIiKBHEWDMetTDOTAY1qNuH11nl97oyZSiqhlPkPYK X-Received: by 2002:a17:907:3e92:: with SMTP id hs18mr5896335ejc.396.1616623567647; Wed, 24 Mar 2021 15:06:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1616623567; cv=pass; d=google.com; s=arc-20160816; b=vX92HgugJxGilYXTyQlZbEWAu3yJ5MExQ32WYjoQdZikC1VypaEw95BZ8RBF1DWDG/ dJSYL1XJz5tMusJU1J61KpGbH8M+MWTL5qk8piamq6FEFJnwqvYRrw6igI3j6JBzgvrm Rimyw4ERI2peTkYLAAvwpN2u4ACf4IhyN40m6Bejeb8wyrBMHuVfe5w1t/TgkHtaYSSI DzmpMj/uYsW7Sg6H64KxCYzTRO+Ro13h5Klcxylrn47CpvgXUGxGWG/lDEpVIFhQmZIK h2iiSgstckAYJKsqRMhYUrWqzNCrxXDbstEkc1YMZ28AaTGTXzyLHrwVK3N1WxSe9hVh fv+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=uS/grFHYooVMCtNqiByTnW84q4eEgMgp2V5BttBbHvs=; b=gXG62i17SR+7yhtGD+QTD2195g/Djaa87e+5PFeiOnLb9MzdtOJeoBNcnt/7G/7vFl 09Fj67cqZwxiCq6Uvgne/kvjG/3YVp/4/SIW6+lolQjmlHdsUmO9WKYCRztRAObhuOGy bhh2IxNY2qQcDdGulVEvhWjGIzZMvt6wKlnsvzTfU3kvZd7ev6Rcryy5Tom2AHd6i3G+ FO2I6nvnTXbyte+rTxeaeCYI7nqs3cggkRHzpCeS4O5SmoUqUSWFrSUn/A4VzyTF860e wP8HGaGhnfuuBvJ2UzNkTnpdqN+aAHF8TGT5t5/ZcPQQm/690FyW6HHamO6qlddASDxi EJKA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=YehoAyU2; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rl4si2734405ejb.229.2021.03.24.15.05.12; Wed, 24 Mar 2021 15:06:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=YehoAyU2; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235008AbhCXDFi (ORCPT + 99 others); Tue, 23 Mar 2021 23:05:38 -0400 Received: from mail-eopbgr50074.outbound.protection.outlook.com ([40.107.5.74]:64996 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232318AbhCXDFb (ORCPT ); Tue, 23 Mar 2021 23:05:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dovnvLnNNAHYx9eL+utiB/x6u6moKgKhL86uX0BYPlTeHCHy+OWgzD9Xz+vy+CnRIbQxCRLd1OIJRCQk6/komkY4rXiLQU9rJHtmVw8n+/FyX+y4pt0Sw4u42a6OxzH/fhaM0Bf8lnKijY+IXA3YDFXc9JP9Lsijam7y0itX6dHxzNJ5hlf2a8kxo2i1o3ppVWOJX7M6Omi8pSzAseloKbl5aXGtA6E8KIj4YuP5EwLQdcowApg91ETd62IkcvONgAD0bB85JEresJAt4mpaK2llqjeR9tx7I0BOVR/wceKIYwz7m09OOw/HNyGxge1jltiIB1IU1+DVSFam9+6arg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uS/grFHYooVMCtNqiByTnW84q4eEgMgp2V5BttBbHvs=; b=PCcpmZeW0cXOVIp6WuuDksxWKx/xSffW8BZ8tEy3WNxuM/dOharIfe1zTebAOXDqf2MF62ApS49pDWF32ZgVvSDEJUoxlol3IKJhJKpDLm/6QSAnVdMqRzSugm57ZnAhbJchfWS5hUE560bAMv+tDKkhYcnB/PZxZm6bSVrcd/qroq/3VHljZILMtcbnwlz6Dog01jaHtM+MD2TUqBQFSDLwdrUY7c6hOn+BD4mDF7J+eOpQA6i8qy+7ic5i53FRNYUsC46HN/PFr9Lw4Icvai/Jswt+2AIZjSUkpQdd+XovtDd5goXmywG9agfqjg+iQnPCb7sMIqLLXJ4Vgt70EQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uS/grFHYooVMCtNqiByTnW84q4eEgMgp2V5BttBbHvs=; b=YehoAyU2/f4TiWiSUW13BOqZ1lNOaKIs91rM16Jvw/FXb+k8jabM24duy6tBc5Xtvi3Raj2/OrheNin1gpgs/39KiTyZFrLDsgdR9JOwIlWduXMH7AmckqtgdOiTz6yMwIyeZB/pXtIgiBVdxZKAhdQE0ks845iFaMTLuTZWhIk= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) by VI1PR04MB2974.eurprd04.prod.outlook.com (2603:10a6:802:a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25; Wed, 24 Mar 2021 03:05:28 +0000 Received: from VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::3ce1:4759:5c33:514c]) by VI1PR04MB3983.eurprd04.prod.outlook.com ([fe80::3ce1:4759:5c33:514c%5]) with mapi id 15.20.3955.027; Wed, 24 Mar 2021 03:05:28 +0000 Message-ID: <417d943c6585a40453e65afcbf6c15d273af3a6f.camel@nxp.com> Subject: Re: [PATCH] drm/imx: fix out of bounds array access warning From: Liu Ying To: Fabio Estevam , Arnd Bergmann Cc: Philipp Zabel , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Arnd Bergmann , Pengutronix Kernel Team , NXP Linux Team , Marco Felsch , Joe Perches , Laurent Pinchart , Thomas Zimmermann , DRI mailing list , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , linux-kernel Date: Wed, 24 Mar 2021 11:03:52 +0800 In-Reply-To: References: <20210323130550.2289487-1-arnd@kernel.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.4-0ubuntu1 Content-Transfer-Encoding: 7bit X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HKAPR03CA0015.apcprd03.prod.outlook.com (2603:1096:203:c8::20) To VI1PR04MB3983.eurprd04.prod.outlook.com (2603:10a6:803:4c::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from blueberry (119.31.174.66) by HKAPR03CA0015.apcprd03.prod.outlook.com (2603:1096:203:c8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.10 via Frontend Transport; Wed, 24 Mar 2021 03:05:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8af90ddb-56f3-42de-1901-08d8ee71ad6d X-MS-TrafficTypeDiagnostic: VI1PR04MB2974: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OgLvdELEghCF5oJAdZLlu3x7MD0AR4CLDKckRLLgHIj/C5YMv0zYS5rP7Jn4EpL8omgCyt7ZdhQGHfRtxdSmQ8jVs0UVlF5an2eNEUp4Hj3PWRS+bCxoDcyLzU6KvYBqGOYur0e7cRE5Tbz/FhWvSlfVUxUjYNSXjyj/cfAcC0GZ/gC+F9WArbT4+kL1/PG59EFf+WysFdTgq/tJxtxeLK9wQr/nXB7DXLgk8GDtqqqaNC8EITjA76qkoFHEEV6GO77R5ipKK2PiEIuN7vPNqbybTGO9nFjAcOJCK3mDk0561GMuA9kVLKIkPArTL4V58aF3OOcyKaVkwUVSq5+/a3fDWiVvC54oxhw9ui+qLrdjdLH5XwYQbq7zx7LX6AlGgcOaOjv0xGG0MaGh0cFZuerdfUm/pmCUcHzIqZ9eWgwZlj+mvOO7mjzb/w9ZPKmZw7WYggkuiM5CmsxmKmVKimh0TwuJN5K0dpA/Zj8WIEOng9UVizhzeRJ6xsvVEhDsoJpvNlFj2E9wiJUOIBifvjNwgJDtBm1Th4dj4GnskGiuy/ALu0wGsWv5KeOfLIeYvbCJTfc13NBxnzDVDD2tVCDEpPAl7IzLnBPyUpIu/DxzF2J6FaPyKYrHeyE+9epR1Ng09leZjIbUL3Cpo7xP7TYC8rhkMgB3PPUa7Mg3r18= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB3983.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(346002)(39860400002)(396003)(376002)(366004)(38100700001)(8676002)(53546011)(4326008)(2616005)(956004)(8936002)(6666004)(86362001)(6486002)(36756003)(83380400001)(52116002)(186003)(478600001)(66556008)(5660300002)(7416002)(316002)(66476007)(16526019)(2906002)(26005)(110136005)(54906003)(66946007)(6496006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?dkp5YnB0ZWw1VEFpWnp4M3lCNnFWVGc5UHVaRmpjaVQwN0s0b0MyVEZNTGZK?= =?utf-8?B?WW5xaDd2Qlk5SXVVc2lrMTdMTm5KS25SdW5vRGtIdEFycVJQcjJkVUlXN0Jk?= =?utf-8?B?NWJYa3pjbUJ2MmVWeFB5ZUZDY21pM3BDY2Ezai93QXQwQXdOc0xkK0NHU1Z3?= =?utf-8?B?TUdQS2sveDNiT2lkcjNCNEZmK01HS1VMWXF3TVhKVVUvSFJWeGIwREN2cHZR?= =?utf-8?B?ZGEzSWtWR2ZTekFreDk5RHVsTjlkcHRBQjNXWHloamJuSkwwWU53WHRUcEMz?= =?utf-8?B?UDByeGtVdHlUUlVrKzZjMHdiVlJhTHpTYWVTZzVxU3RmdEZ6dnhZMG5MVGl3?= =?utf-8?B?UHB6cTBsU1V6bHpWd0R5aDRIaHRvVU0zNER4WENEZytIWVJTdXZEaW1hSkdz?= =?utf-8?B?UEFuVU9YYkxEdjZYRkpwZkFoK0lQaE5sTlRPRFNxNzhhcDFPMDNEQ0VuYlkr?= =?utf-8?B?MXBUckxDeTZBL1JJWXB5TTM3bzlaV2kxdm5aUU9MbmlEVzhWVW14R29YM0hE?= =?utf-8?B?SlVHU285a2ZxOG10MVVXdGwxNlJ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HYS80SEFvL3ZCemUzTW1TdDJOMDUrVStFcUZ4MmI0?= =?utf-8?B?UWRjaDVsR1dwaXRqeFkxTVJkRUJhNHNNcit1NTgxalh2QVFXVTNIRnlqMERB?= =?utf-8?B?VUNvamdaRmFjZk42cmhvaFV2NU1lZXRTUlJkQVZKZWNpT29mcHRLQ08yTURS?= =?utf-8?B?aTJaVkNuc2ZGaVA0dk9rRUluR1N6UndqOXVnSGlzWU1tU0tmOG9aOHZ6bWRU?= =?utf-8?B?d2J1K3lRU1MvenF4REUwRUt4eWNiQnV6ZUV0NmhTLytibW9JbGhUNmc0WDhW?= =?utf-8?Q?bs8pJletihPUAHv2SUqDOVDnP6dwDhe2aImDvLC?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8af90ddb-56f3-42de-1901-08d8ee71ad6d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3983.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2021 03:05:28.4986 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HeOVBS4nEzDNM8swAGNxls2Cuqyvv1e5HxQnnBDqFMtNG+JzHWlO1yJmmEmoUToT9VgBb/PxUwqOxlMAcyg6oQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2974 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Fabio, On Tue, 2021-03-23 at 11:02 -0300, Fabio Estevam wrote: > Hi Arnd, > > On Tue, Mar 23, 2021 at 10:05 AM Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > When CONFIG_OF is disabled, building with 'make W=1' produces warnings > > about out of bounds array access: > > > > drivers/gpu/drm/imx/imx-ldb.c: In function 'imx_ldb_set_clock.constprop': > > drivers/gpu/drm/imx/imx-ldb.c:186:8: error: array subscript -22 is below array bounds of 'struct clk *[4]' [-Werror=array-bounds] > > What about making the driver depend on OF instead (like it is done in > DRM_IMX_HDMI) ? The below patch made DRM_IMX_HDMI depend on OF, because of_drm_find_bridge() is not defined when OF is disabled. drm/imx: dw_hdmi-imx: depend on OF to fix randconfig compile tests on x86_64 It doesn't look like DRM_IMX_LDB is in the same case. Moreover, even if OF is enabled, drm_of_encoder_active_endpoint() is likely to return -EINVAL. So, it looks ok to add an error check. Regards, Liu Ying > > --- a/drivers/gpu/drm/imx/Kconfig > +++ b/drivers/gpu/drm/imx/Kconfig > @@ -27,7 +27,7 @@ config DRM_IMX_TVE > > config DRM_IMX_LDB > tristate "Support for LVDS displays" > - depends on DRM_IMX && MFD_SYSCON > + depends on DRM_IMX && MFD_SYSCON && OF > depends on COMMON_CLK > select DRM_PANEL > help