Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4184781pxu; Mon, 30 Nov 2020 20:58:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTYHjgYBpWKsOSLIP7XMMRo9Qcp1UEgUO6crYk09E76xgs6daL87lVIgghuM/RwDVNTWWl X-Received: by 2002:a17:906:7016:: with SMTP id n22mr1295248ejj.402.1606798736470; Mon, 30 Nov 2020 20:58:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1606798736; cv=pass; d=google.com; s=arc-20160816; b=ojPAhJRKkLnkKRcS5k1jvcnKzBiOtH06bnR1pd2SFXLaOHj42aFPSCBOslZhE7IXrV ctRg2bTPor9+ilaAKad3V+oasv2LTbJCp8D9EdsQ06hlVmHEDie4Hw9pZK3Wsnd+x03g YaDhPTwgykvCH5flV8KndqXsQGjMeiLferCYhMMMX77TQ5ccmQju9e0srnQSY3XlBwiB aKksMdFk1UnWPXK0v5Mixqo8fM1h8nLu8i8zpRONRK/ppBs7h/mUefqjsImq9vmTsylW yjSyKwgdd602GFAB6BioWZ7Hidn8m0ezCBdfV6/lxC9YMdaK5x1vyHeg/l0keKnpIZjy geuQ== 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 :dlp-reaction:dlp-product:dlp-version:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature:ironport-sdr :ironport-sdr; bh=vRDOFefwR1emV1seqHtQ5kwuW0m9E7ebutEBaQH81dI=; b=Cy+x2x2tYQpjoDyd36dBlwJN6KBYtUS7HwNhilxHTFBwHmZ4V0IpUrSLax42ak0Sne E/Ne9Npb9z0Yi6CEKUFyt0y8UTdL+yUzhumbFaly6w0V92zakSXFrippkU6wL23965Dm ruogN2ft7sd3jYYJJvR6ThaDpMm/lugSx41lUsR+foNuNoeMlxO0Ae7bRGBK5+CPuzZC Ove2cM4gzXprjVu7/eV9lCRGT0KBCt/L32qPiHZwgIDej6SjZkQofJVurJGWl/Xgmg7p slW4U7VogHsTRbQ1cWKjbo1pd+8QG5TiopWal2xGu93ki/e/mGg4ejsDLd+9DwKxp7WE KBAA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=ERoKYmtM; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si410745eds.113.2020.11.30.20.58.33; Mon, 30 Nov 2020 20:58:56 -0800 (PST) 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=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=ERoKYmtM; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730555AbgK3WUE (ORCPT + 99 others); Mon, 30 Nov 2020 17:20:04 -0500 Received: from mga07.intel.com ([134.134.136.100]:41156 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726775AbgK3WUD (ORCPT ); Mon, 30 Nov 2020 17:20:03 -0500 IronPort-SDR: Wi7WEP4eoWKPWifBjxf68XMGtXKn+a5TfwkqKyoJsw1X/M6925MjLxhY/KobpSr1Kwh6skqzCc 48Ev/M9WnRhQ== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="236848863" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="236848863" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 14:19:21 -0800 IronPort-SDR: NcGdWr4bWSLqPOZK9DFoDM+WSAycYF8L4nNj/zOKfpsce3Ktuhz/k22AG+vcV64QYrLMUBh4qL JuyPoXgCX7Nw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="314732247" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga008.fm.intel.com with ESMTP; 30 Nov 2020 14:19:21 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 30 Nov 2020 14:19:20 -0800 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 30 Nov 2020 14:19:20 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 30 Nov 2020 14:19:20 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.44) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 30 Nov 2020 14:19:19 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ezDwg1qWnQVejOrxeU5Vx0BIrD6/JZlRyJc5xT+YqjaG6HXWaPvwdqXmd0F6bygFVsxJ3CnxrbXSL4my+jWdA3hJpoGg/UkLizBugxm91knUShZuifwK7T4cNuPE+h8yChAQwf1E573rxbtp+1Ih59FFZNxdmx9/+H9Ze6iyuYYSQ/TPLqEpT5qtIBx3KgyasI+3KpkxtPLkNnMIDAEwF0IqsiEEs2BTuS9N6O92X3nWAIE4asnNPBA0YFXpW3Bdm8M/73TNI5HcrDI5kfFPLI4F25WlQVnElocOchOR7RDBTjTjms8SpF4sLX58Kgtew8b4g1TqDUcJsMAAJtsHbA== 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=vRDOFefwR1emV1seqHtQ5kwuW0m9E7ebutEBaQH81dI=; b=m8IrNiYIRy8FnPGu4om7GcomXZYT2gSfa7vvUNxs02yPTe/IwlWKe/8kMS3bM7yrbDg6YYQtYDIQ+Ng/K2VAB14syfOcELVydAIElAJ5bQZoK5+samOLLhLLorIl8alGDJ43xQ4JluoCAfsTF9CaCz5YG6T+tuwPRsTBq0oQ4GDbvKP9ZeRnMBMIEGocaV6KIS12GKg1xfY/jOdxM0s0cEb58b475JvKQE5QhexwMh/ghDiVqru34RwAKFPEjjh/7YvHlM0+hxW4hLz5Ft0D8ACQNiyHuQcZImDfT8/r5D1eYLFyGTWbCfuoxfneNzJVwY2oq+AHL5AdQXUt0eOyMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vRDOFefwR1emV1seqHtQ5kwuW0m9E7ebutEBaQH81dI=; b=ERoKYmtMny5twOSIKIeqQ0KHWFsarabwAVT0FbWWUvZ156uA7cKpL5FRcUp3cUI/vBI260kFwwKq5A60EeMU5aQsv2LSOSgKuWDsZGjpE0KTHGJ20CdvI0lj/4zNnef7kk9Y8C8KgM92G1RFK1A/W/B12aZxpW2fP74nMTGGy5k= Received: from BY5PR11MB4182.namprd11.prod.outlook.com (2603:10b6:a03:183::10) by BYAPR11MB3061.namprd11.prod.outlook.com (2603:10b6:a03:83::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.31; Mon, 30 Nov 2020 22:19:14 +0000 Received: from BY5PR11MB4182.namprd11.prod.outlook.com ([fe80::285a:2709:d92f:3394]) by BY5PR11MB4182.namprd11.prod.outlook.com ([fe80::285a:2709:d92f:3394%5]) with mapi id 15.20.3611.025; Mon, 30 Nov 2020 22:19:14 +0000 From: "Chrisanthus, Anitha" To: Arnd Bergmann , "Dea, Edmund J" , David Airlie , Daniel Vetter , "Sam Ravnborg" CC: Arnd Bergmann , lkp , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] drm/kmb: fix array bounds warning Thread-Topic: [PATCH] drm/kmb: fix array bounds warning Thread-Index: AQHWxouYX6RKw2p6RUm12CsNuNmoW6nhP/Ug Date: Mon, 30 Nov 2020 22:19:13 +0000 Message-ID: References: <20201129200927.1854104-1-arnd@kernel.org> In-Reply-To: <20201129200927.1854104-1-arnd@kernel.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=intel.com; x-originating-ip: [73.151.242.136] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5ca015c6-b3c7-4226-7e62-08d8957df83c x-ms-traffictypediagnostic: BYAPR11MB3061: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:83; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Cu6K0TgBTVuIaOLmC9K3pfmE5NxU8hWQh1qAIUfRm/VsULeVIf9HBg5lY0InkpXa4Zz3Cak5yGyEL8/ZdAgPeou+OZxIKrGkVAeHDyAjVWHcmWOcRfulBYla2rF8tQClH2fjJIBjjX4BqQt9Mj7rVkK2F3xE6yrwpBqpLyR2AiiBqeP6yR3lrBWWLe3rjAKnTshz6STQLuC/h3RlGlkVkhRIRZARLce05XbbzXFVkdRZEVAAsIc05hn6N+iHDcb5p5qqD50N+ZTf54HQUuw+P9KUPpMPDELYNDzhY1ioiHmq63fpSZhYVzFOA+UUJ+6VQFc/yvMSmToUm3jmj4cQPw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR11MB4182.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(376002)(396003)(346002)(136003)(39860400002)(186003)(8676002)(8936002)(7696005)(52536014)(83380400001)(4326008)(5660300002)(53546011)(6506007)(66446008)(478600001)(66556008)(55016002)(66476007)(76116006)(64756008)(71200400001)(26005)(33656002)(2906002)(86362001)(316002)(66946007)(110136005)(9686003)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?gX1IToyszOLOp0CReUpnmM1aSKG+Cms83AiiqN6nYtXq1oRb04XlEnp9WrHK?= =?us-ascii?Q?ucbJ7HLudPYRs5O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dNZqX?= =?us-ascii?Q?js+19rMKkwVhwkWamd7qYGNjp/P0upSXRuitn7uvc+o=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB4182.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ca015c6-b3c7-4226-7e62-08d8957df83c X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2020 22:19:13.9730 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RApg5hlgkB5KaAXxKjYzk6P1AXy5Rhlzg2kQC8YjNlfIgtDAttp3WLXfwpExOXFeurMKySPk/8tBSAkf+lCUPfa+tiIjIOIN3z5donuHAno= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3061 X-OriginatorOrg: intel.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, Thanks for your patch. > -----Original Message----- > From: Arnd Bergmann > Sent: Sunday, November 29, 2020 12:09 PM > To: Chrisanthus, Anitha ; Dea, Edmund J > ; David Airlie ; Daniel Vetter > ; Sam Ravnborg > Cc: Arnd Bergmann ; lkp ; dri- > devel@lists.freedesktop.org; linux-kernel@vger.kernel.org > Subject: [PATCH] drm/kmb: fix array bounds warning >=20 > From: Arnd Bergmann >=20 > gcc warns about an out-of-bounds access when the using nonzero > values for 'plane_id' on kmb->plane_status: >=20 > drivers/gpu/drm/kmb/kmb_plane.c: In function 'kmb_plane_atomic_disable': > drivers/gpu/drm/kmb/kmb_plane.c:128:20: warning: array subscript 3 is > above array bounds of 'struct layer_status[1]' [-Warray-bounds] > 128 | kmb->plane_status[plane_id].ctrl =3D LCD_CTRL_GL2_ENABLE; > | ~~~~~~~~~~~~~~~~~^~~~~~~~~~ > drivers/gpu/drm/kmb/kmb_plane.c:125:20: warning: array subscript 2 is > above array bounds of 'struct layer_status[1]' [-Warray-bounds] > 125 | kmb->plane_status[plane_id].ctrl =3D LCD_CTRL_GL1_ENABLE; > | ~~~~~~~~~~~~~~~~~^~~~~~~~~~ > drivers/gpu/drm/kmb/kmb_plane.c:122:20: warning: array subscript 1 is > above array bounds of 'struct layer_status[1]' [-Warray-bounds] > 122 | kmb->plane_status[plane_id].ctrl =3D LCD_CTRL_VL2_ENABLE; >=20 > Having the array truncated to one entry seems intentional, so add > a range check before indexing it to make it clearer what is going > on and shut up the warning. >=20 > I received the warning from the kernel test robot after a private > patch that turns on Warray-bounds unconditionally. >=20 > Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display") > Reported-by: kernel test robot > Signed-off-by: Arnd Bergmann > --- > drivers/gpu/drm/kmb/kmb_plane.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/drivers/gpu/drm/kmb/kmb_plane.c > b/drivers/gpu/drm/kmb/kmb_plane.c > index 8448d1edb553..be8eea3830c1 100644 > --- a/drivers/gpu/drm/kmb/kmb_plane.c > +++ b/drivers/gpu/drm/kmb/kmb_plane.c > @@ -114,6 +114,9 @@ static void kmb_plane_atomic_disable(struct > drm_plane *plane, >=20 > kmb =3D to_kmb(plane->dev); >=20 > + if (WARN_ON(plane_id >=3D KMB_MAX_PLANES)) > + return; > + Looks good. Reviewed-by: Anitha Chrisanthus > switch (plane_id) { > case LAYER_0: > kmb->plane_status[plane_id].ctrl =3D LCD_CTRL_VL1_ENABLE; > -- > 2.27.0