Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1727160pxb; Wed, 9 Feb 2022 03:14:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJ1c6VmDM4IP+zgMe1nFcTyNfgw05vmRHZMPZxrkOQKat4FAP4Vw80KMxJM/lnfd3AUptn X-Received: by 2002:a63:258:: with SMTP id 85mr1450631pgc.609.1644405281043; Wed, 09 Feb 2022 03:14:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1644405281; cv=pass; d=google.com; s=arc-20160816; b=RbIFoJGNus5GdAiluotkkT6d9Chvvi4fVLHW+eLFZ+CsDGjBoORT4MtdaJcsMtLD4Q Ac30dWwHL6LKJKC1Rx7qxRkKKkU58XxloPK7Su1Of+bs3Cvt99I4l764FA4yVT7a1vcv wIx7e8z9kp8FHyK1EiMGdtBVwNQ5U6CvMnFfZtgDeksikK+7aeJWmsALaNoRM7uOgbz9 17r8a1ebPGN85FP9Zv74SLRRyPhbamZ/UGMMzm7xZeujHnd2+972vMyRMW8gD1TuJ2Lh StOSCGdFKGApJLlq+t8ZwpFRqv6j9h8SMWJMrw13UUtpi6agqFs2I4gsrB2E9hb0zQM0 lTCA== 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 :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=DU12EsFe2f/FmvfwtuaFYQIcwJMZGgI75PfUl1ZDp3Y=; b=K9c5meeZOAN747loD9bi09yBghmrG9u0qPyx1Upcpx6Y+DTsL3IQNwHLX5237q3Kxn yxFUEFdpndQx/w2dlBLPzbYlod0edO4apf91RKtI4nbM9ClVNEFKI/AQGJRZ51PUJK1E QCKe3UCJ195gB+PH9wNfmZMEypUnj47s8L3oheGIzawZ3DPNOQNS6eSEcjqxZvKXEPxq jrpm42JLTmAw9sTkLgVWLA4Dg6Xbn1ghyW3M05uNN/Kw3ZsvU3uH0BXjNgTj3ip+ItxA U5NtBnKAr+pxt2WIVo8h/YsnetOcRHiOo1Qc9EMGrUFD3Gb4aaZYqIz4OrjBWpGKnrhA p9Kw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="sOF/TWos"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 26si374491pgw.789.2022.02.09.03.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 03:14:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="sOF/TWos"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65DE5C0302D0; Wed, 9 Feb 2022 01:43:46 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244153AbiBGIGb (ORCPT + 99 others); Mon, 7 Feb 2022 03:06:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236726AbiBGICJ (ORCPT ); Mon, 7 Feb 2022 03:02:09 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2085.outbound.protection.outlook.com [40.107.244.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E7E7C043181; Mon, 7 Feb 2022 00:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D8GG8TD4oyJBelKLQ28tAdxty7eE+nRwfjjaFjs1o4tZPt7LI/VqMhaJUDIzVtQqpUNwFTUgHGh3hlCCnf+Ck7TVmA66/gEeECJt2SsdBUl+3QPVQjdOxpXUf6d1/pnppjRjulc20v/VrZYwEg67WGEPA+vDE+R4vhEnWxdK4sFG/t6cuN9BaMN2C6vuOMmyzP0+1uzbh1PxxtOpGIzp6sPkvzehHchFrwoY9WxJEhOkAmwDM/20t4eTI9N3OCO91KbbVgthBKJqMMWk6XU1IoljDWtJlfHBJPf0b6nu/Aod87ZZQK7D9hNDW7LwPEDzzGk2IucfBKE0uGdovzixXQ== 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=DU12EsFe2f/FmvfwtuaFYQIcwJMZGgI75PfUl1ZDp3Y=; b=MhRXt3TYUgppanpksQjkq4U9sK9yJoVLgUxE0pfxaaFZB9LFfsswXuKllrZznNCowNlh6SNwqxGlVhbqJtcEofNAmnj4aWKmvyM3foXNoup77vM8SMkgMbSljrVhwk87O1gw7P0pEJ/1+0dItppn5Spr1ttJrU/SwzHadLrsfxNCAZqm0ei0CBQTvlVP/3q9sjsJYK/H5IveITNap1/99UEHzsajBwTfGgNsPr2Fva1R7lnWZbBYLUKKLPW3aE5+PS9pfYL6Re2GrfcTNV4uPyXt9LJRB7B5Uy3AOU6rLcCjOnILPFsUy5QQLq0bOfuHLbDYALQk5PQ2166HLcJikA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DU12EsFe2f/FmvfwtuaFYQIcwJMZGgI75PfUl1ZDp3Y=; b=sOF/TWosYpN7wViuSYStM8Y5aVVB8bFzGOM6m1rVE9zcPD4UQTGd0VxBtnAWVaZ+gAQU4fNj5TtmxCaKe8yM2rHsJro+nsT3hVCPu2ZFLiEqnIp/FAUGTYAMSOw7csX6gLK2OP4hivNscS17/IW9am8SWCRQcQevxKflZ/mXFCE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BYAPR12MB3589.namprd12.prod.outlook.com (2603:10b6:a03:df::29) by BN6PR12MB1556.namprd12.prod.outlook.com (2603:10b6:405:4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.11; Mon, 7 Feb 2022 08:01:57 +0000 Received: from BYAPR12MB3589.namprd12.prod.outlook.com ([fe80::e920:c950:24e1:1154]) by BYAPR12MB3589.namprd12.prod.outlook.com ([fe80::e920:c950:24e1:1154%5]) with mapi id 15.20.4951.018; Mon, 7 Feb 2022 08:01:56 +0000 Message-ID: Date: Mon, 7 Feb 2022 09:01:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] drm/radeon: Avoid open coded arithmetic in memory allocation Content-Language: en-US To: Christophe JAILLET , Alex Deucher , "Pan, Xinhui" , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org References: <1f44de96e6a49e912111fb3b664f087328b4c2cd.1644082664.git.christophe.jaillet@wanadoo.fr> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: <1f44de96e6a49e912111fb3b664f087328b4c2cd.1644082664.git.christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AM5PR0502CA0005.eurprd05.prod.outlook.com (2603:10a6:203:91::15) To BYAPR12MB3589.namprd12.prod.outlook.com (2603:10b6:a03:df::29) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6dfdfa9e-f29e-4008-54e4-08d9ea101c1b X-MS-TrafficTypeDiagnostic: BN6PR12MB1556:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sJbC5238VzISaTW+qIYa51zKWUnLr43fQTXEv5bPQNG8CjGEVZJUy8x+n5iaSlL3B1XF8vJJdH9XixK3pD25520WjU99O9zOA1Ff3yPaZepXNOjmCbpis3ZPdSZj1UdimWs5xUufIfVL75L697sVsQFlDT5E51pv2nhgDaGDOPoWK2hR3u1pV2k0KFD8wwgHzvZnN5ldoCkvE1JNuSjnzaYWp7bDUNAlp+UtH8y/nZt/21JS/agGk5xzLDOHs9yOX4K/yfGetLWzds66xsubFEaMNpiJzT0uGy1BSAQ6bET4Oak178SHwz3PdnbOgGMo33CTqwbmPF+Tv4UPzNMRRlHxpYSwCy5fZk9LQGmhexcVbxkDCdZSIiy1/B87A/oMwoSScTm/nQ7RTd6/BWIA+kqE5PR++b8qOFuZ+vHWa8MgnYioelaic5yE0VdYYGIDqNN233d/az2rvkqZWOgHmtWKPU2iMT0vh2avowoYF2QTpWJ33Uf20y9bsMiUruEtb7SFrqRDnOvpyxKg76vY1bg0447GExMCi4pareK1wxrd/GCgBF0OtB3uapTpEgeSVrNud3swj3Gqu80KwPzbnktmjqe6ErGniBmexGer0T7RaTTo63ptw41E9TGlwmxUVCJmaeS6yAvxjb7EFXD9yyNINuohAbuKqR5GpnhnHpx4aKp5+910F/wkNon1khi/bLgm3E0aroRHIPHVp7FpVinQWBmZftPhTFLUgwxJyOua4psciBJ5CEKi/3e6PsFb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3589.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(186003)(66476007)(38100700002)(66946007)(66556008)(66574015)(5660300002)(4326008)(83380400001)(8936002)(8676002)(36756003)(31696002)(508600001)(6512007)(6666004)(110136005)(31686004)(2906002)(2616005)(6486002)(86362001)(6506007)(316002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QkZRMXhEZnNLSFphY2R2ak8xRTZuZTJWcGNMSVFnSW81WEVpMjVLZDZGbDV2?= =?utf-8?B?RkxyRjZDSitlM0NnYzNETUxjblJheDdqUUQrdEJKdVZ2Z2NpeThSbE94UC9k?= =?utf-8?B?aFdCSU1Ya3lNRGxoSml6T3VQOEpHK1I4WThiM2F6NGhsamtYWk9rcEUyalVE?= =?utf-8?B?Vy9sbW9JRnYyeEhVbERIdENXV1hhMk9xNEpHd0ZtKzk1TEIvc0Vpbit2Y2ZJ?= =?utf-8?B?MllheVJ0cDYrVHdSY05TVjJDTXMzUjM2dnNTQWFESzRXK1RNdWVTeitJRmh5?= =?utf-8?B?R015OU9kdENVa1gyS0tBMkdNRVpQVWE2VENJK01USnlwcm9DQXRrWXRVVWgz?= =?utf-8?B?N0ZuMndWKzZzcXVzSWdpS1RRZEVyYVBLeS9aN2psczNFMUozemVYQTh0RG9z?= =?utf-8?B?eHBmeWVJbUN3TVFTMitDV3d5YVFoY2VCTWk5UmV5R05ibFhyOFVmbk16dUp4?= =?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b X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3589.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2022 08:01:56.5002 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: geZpJg64laR+YJB+wxmvv7k3T+UeAgvxj0pk9GlLpYXPrc3KAfqF+l6YZQbFZLm9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1556 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 05.02.22 um 18:38 schrieb Christophe JAILLET: > kmalloc_array()/kcalloc() should be used to avoid potential overflow when > a multiplication is needed to compute the size of the requested memory. > > So turn a kzalloc()+explicit size computation into an equivalent kcalloc(). > > Signed-off-by: Christophe JAILLET Reviewed-by: Christian König > --- > drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c > index 28c4413f4dc8..7b9cc7a9f42f 100644 > --- a/drivers/gpu/drm/radeon/radeon_atombios.c > +++ b/drivers/gpu/drm/radeon/radeon_atombios.c > @@ -897,13 +897,13 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct > union atom_supported_devices *supported_devices; > int i, j, max_device; > struct bios_connector *bios_connectors; > - size_t bc_size = sizeof(*bios_connectors) * ATOM_MAX_SUPPORTED_DEVICE; > struct radeon_router router; > > router.ddc_valid = false; > router.cd_valid = false; > > - bios_connectors = kzalloc(bc_size, GFP_KERNEL); > + bios_connectors = kcalloc(ATOM_MAX_SUPPORTED_DEVICE, > + sizeof(*bios_connectors), GFP_KERNEL); > if (!bios_connectors) > return false; >