Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2436157rbb; Wed, 28 Feb 2024 01:29:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVz65rNoLW2dEPpqjmvqDzGpbouZcCl9QldI4NK3wPawZ1wosYPgIqyY/dEOImyFhyipL8NzYwzZdK+9Z8UEkb8k5/ShtWWrcs+mNcDCg== X-Google-Smtp-Source: AGHT+IHkeTJXI23WouLqswrUf/gXW9G9KP69xsAxPdcDdY2BWRry1pXLv0q7WX+0xqf3aC/3CJt6 X-Received: by 2002:a17:90b:911:b0:299:6389:2961 with SMTP id bo17-20020a17090b091100b0029963892961mr10629192pjb.13.1709112551290; Wed, 28 Feb 2024 01:29:11 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ip8-20020a17090b314800b0029ad1df281dsi1037653pjb.53.2024.02.28.01.29.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 01:29:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84761-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=GA7yAhVr; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-84761-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84761-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 01862288983 for ; Wed, 28 Feb 2024 09:29:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45141364CD; Wed, 28 Feb 2024 09:28:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="GA7yAhVr" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2072.outbound.protection.outlook.com [40.107.22.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B77772E859; Wed, 28 Feb 2024 09:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.72 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709112528; cv=fail; b=EPmrF4snoTVpKh2145EnD7zWcxhvQvTygBCqgyWoWGqjfvBSi5ESPO8BBaEQXx4bsY+1rZSnIJIq+oDaAMvzmYWJHoHnCoN2LL2XhZFWFXRAsSaLy1iZ60d+7Jl62HAcAvByKmihYYCPRED5KR5ETQDaATCpAFDeIReFhxb5p14= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709112528; c=relaxed/simple; bh=jXTA3NA9f9/qHIBW7HyD0brTyoYO8Qoj5+3CjHwgQ5w=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=IVF7wu65y6kcLqssWl2aXcd13e6YvVyxCZ1HSwBZTQTBiGdgc8TuKVCftvywHI61BVNG7s3AExEVN6FKy72FFRSzAsD6DK+i52JsTcVrZBTWyQjJckGQ7NZB5AD4dmtH+KAEFBL9/R79JGTNpUgm2qIHIAiBG18MEF9ip87/EFU= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=GA7yAhVr; arc=fail smtp.client-ip=40.107.22.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FD1+yl2wvRXw8BBFbP1uS1UkiwqqIAPGxsLTP0/MEgs/2LrIgM2aOpPJTPuzwtp4p3Iu8kz5Fbwy1IteRMiSWqLktfOfCv5UoIDY9+1gDIFk5+hw5SYCn326Y4Pl3zTwRV4JxotyCjGaMALC2fm2Y5mrfDsbhHXd35OhLU54Zb2ctY/ROh/1GxJAl3CIDtPi9GBlfQIyos8/PaB8zAGWnYsScyL2HsywMNlyXmJHKYdinfwLXaI3/rtck/gzBHsOTG9KrKhGJo+eAogkXUFGrAD58kpjZDT4wlO4wHM2ZAVoL3EpNvPa7S+tzGDghrPM0jXy4yiidZPGstN+zHUXpg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pBEoo8yjOmb6pUjJm32BXUOAQc2IcNKgsm9gyZacvOU=; b=N+aHsLhtKX7QnGBYFXlxDu3/0EWeeZI2FxGOckar1t5GOzNITLEgBPiWDzmx4kZBcseCMPrRXUhxEiiRMf9m8DFUx26nz7M+t2SNQ8+cmElXgctO7uj3XBlce35pofDzkZeT+m3YIecBsa5+R4IO7ERAJWa7FcO7DY02ahDTgL4SBwkRtX19dYxh44lRa2qsq+NRjnxGAI8X3DhYYPfvS4zjRtRuqAkGXzYxLGh5vc90XvBDgUgyJ1xh0RST8hWYg6JVfqwdZt6vV/cDdG3/aMUjfzWare/oW3lebSTDCfnrwXSwpXL+SuQI/CfhG5ecNc3S6GNUM16kA7c9KhGHkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pBEoo8yjOmb6pUjJm32BXUOAQc2IcNKgsm9gyZacvOU=; b=GA7yAhVrh9qxtlDC7YWaiDw0rMe5qbEkdYwXEKNWxpmMhl+XGbI7uVOHC2nHvJosO0ZLndG3I2b9ep4z7OF+WdxXgozy0Sll3Ew5ARCcnJBD07wG0sWF73v6OG6bpo9XMHDYsYHaTyca8mB2MRi3Y/KIQ6ho8JZ0dZF2z0LzYMs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM6PR04MB5333.eurprd04.prod.outlook.com (2603:10a6:209:4a::22) by AS8PR04MB7560.eurprd04.prod.outlook.com (2603:10a6:20b:29d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Wed, 28 Feb 2024 09:28:38 +0000 Received: from AM6PR04MB5333.eurprd04.prod.outlook.com ([fe80::e905:d263:1321:f08]) by AM6PR04MB5333.eurprd04.prod.outlook.com ([fe80::e905:d263:1321:f08%6]) with mapi id 15.20.7316.037; Wed, 28 Feb 2024 09:28:38 +0000 Date: Wed, 28 Feb 2024 11:28:32 +0200 From: Laurentiu Palcu To: Dan Carpenter Cc: Philipp Stanner , Lucas Stach , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] drm/imx/dcss: fix resource size calculation Message-ID: References: <4914592b-4256-4c9c-bc1d-6dec1e473831@moroto.mountain> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4914592b-4256-4c9c-bc1d-6dec1e473831@moroto.mountain> X-ClientProxiedBy: AM0P190CA0023.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::33) To AM6PR04MB5333.eurprd04.prod.outlook.com (2603:10a6:209:4a::22) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB5333:EE_|AS8PR04MB7560:EE_ X-MS-Office365-Filtering-Correlation-Id: 171a0b4b-6cf3-4ce6-b129-08dc383fa4dd X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +H8AFY5pX7d3NYuT3C3FvfIv+b4eQVeL4ZAdMU8JCfPxuQFx84hEhxzbFD0FbGIniJI6hK964h07J5egcQxAR7BUnkkWEgumwAdXK9214vTARpnX2ukiemTKOq4O2geQea8Tc0La2yGuzszbJ26CY38c+3qPlUJMWkWGZi9A0YeuSRWJOYfkX/EJG20WFh4ZzjvG4ad+OrgkcXYCf7TMR2Lsj6RJk1iSipe55GBD8sIWAtbxAifgYWLbSeFTJcCM9PUSsHDgAVshU4wFP1L1GCtyWTDtdr8IXYXjuQcGRYXXzety9kCgIQkMjKf7ht7o6Qb39RjcNiCJrC5thmHXGAJBGy9tjAPsSwi68acq2SfLboUnxFItj1PCNQokig7L8J5MTtDScorkBYhkQ/8q8Yx1LPen92nA8ODMpvZskF/Z5sQUji4n8tll7r9+TZwLPujqR4cQ9dbDqJXG3wcar9SGEqcyImok5iu1OGx4kWpqwcf22tcKJOfY/hBo/V1U5p0rUtCOvLpJVnpw5cErP5QC2UK3BGlddBEzcIj+pfcxAO84PJWEUhZt3nfGMyX6JKbNUqbn41F0HJo4qAzDrMw1EORpuZPys1jN6Hq36i5bhcjFwUdiU1q8dJtV90Y4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB5333.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CfksxUt5mR71ioMwnGjkaA0huSTemciiF/p4Cwf07YQ9sJjM5QpoFkP95FoU?= =?us-ascii?Q?o7m/AmLp/5hKvytTWCFol4LrBb41gm14lIi2QU9U7EfYD7OtvMmtsknojUOZ?= =?us-ascii?Q?Q/Tv7XqVPjn26fLeNG69r1mRYRiX+9+k05CK8xGXE9yU32p5Cf0lW9jAWi7l?= =?us-ascii?Q?1LR3m2/aUmqDwCYtpTJ6Vm0NS9SH1j7QAmE/IBvJoU7GncLG+P1+p++Hvg3W?= =?us-ascii?Q?01Twuf7CZ0rra3saZ4qYj/+/eXu6N7XDS1UZ8KmzRVlgwvdhFCWioh0IOynJ?= =?us-ascii?Q?4zw3qOsIl5ww0d3EUgedZAQhKSz/yJrImB5IEP43hW+QZwi8oAUSBJgmAdnF?= =?us-ascii?Q?w/+MqKHQWjYRXESBTink96bT6huSJbfAZsSNmUOeAstyyWQ+eXkMOqZThgsx?= =?us-ascii?Q?Bj8a/g/gZ+nmaJycfOVCfDp2PlXcvC3Bo9EUIAhghr2IaDJP4fRliWYKVE7O?= =?us-ascii?Q?VFAFJNm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?us-ascii?Q?bxd+igekDTa1w9YtUjlOyDa+z8DMQvlcJdwuQ0c42T83ps7eGwJQ7vFGv9iy?= =?us-ascii?Q?MbfEhOWL28joUcnKTEjN1EIylUK1qW4eYipg0I4DEiri4PgTxTOZfp2i3hJR?= =?us-ascii?Q?V4hTMDT3KDfT4rDEc2QS69wqNj/OuZ7G149JTD0EfwCBX+QQaS6xMd0r/JBz?= =?us-ascii?Q?/Ak8oA55OUKTEdO/2o2nQCyO4MIOGCv5uoEOA1z8NKOdpeM+uXid//I3lhNO?= =?us-ascii?Q?ww=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 171a0b4b-6cf3-4ce6-b129-08dc383fa4dd X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5333.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2024 09:28:38.3158 (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: NuTgRRy8xlblTitfE4aAEvzOMhC6vsvu0yx3mz3MaZr4PhEsJerpO7javdtfmYb033jnNonXTVNifRqy6HaoPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7560 Hi Dan, On Tue, Feb 13, 2024 at 09:05:01PM +0300, Dan Carpenter wrote: > The resource is inclusive of the ->start and ->end addresses so this > calculation is not correct. It should be "res->end - res->start + 1". > Use the resource_size() to do the calculation. > > Fixes: 90393c9b5408 ("drm/imx/dcss: request memory region") > Signed-off-by: Dan Carpenter Reviewed-by: Laurentiu Palcu And pushed to drm-misc-next-fixes. Thanks, Laurentiu > --- > From static analysis. Not tested. > > drivers/gpu/drm/imx/dcss/dcss-dev.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c > index 597e9b7bd4bf..7fd0c4c14205 100644 > --- a/drivers/gpu/drm/imx/dcss/dcss-dev.c > +++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c > @@ -167,7 +167,6 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output) > struct resource *res; > struct dcss_dev *dcss; > const struct dcss_type_data *devtype; > - resource_size_t res_len; > > devtype = of_device_get_match_data(dev); > if (!devtype) { > @@ -181,8 +180,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output) > return ERR_PTR(-EINVAL); > } > > - res_len = res->end - res->start; > - if (!devm_request_mem_region(dev, res->start, res_len, "dcss")) { > + if (!devm_request_mem_region(dev, res->start, resource_size(res), "dcss")) { > dev_err(dev, "cannot request memory region\n"); > return ERR_PTR(-EBUSY); > } > -- > 2.43.0 >