From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5A8C742417; Thu, 19 Jan 2023 15:21:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B05740223; Thu, 19 Jan 2023 15:21:04 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2049.outbound.protection.outlook.com [40.107.220.49]) by mails.dpdk.org (Postfix) with ESMTP id 8D3B8400D5 for ; Thu, 19 Jan 2023 15:21:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GShV5lInUiDwiJ9MzRd3ET+CmRePrBQ1qPSo/GkaxhuyyMDXnkIy/nXmps8WG4vvo60FTnm9g3LvT0i9fWkPrrliUvDJUSfjOvFmDCaBCLbzei6DXZqEOsgzW8h2alPSU9GslrJ79WPA10+HlSXMX8dC7WV4A+h0r/TFUfrft9GOWWA8WZYox7Phi4WxKcys3D4c4J+I8MQqO5Wd5cQuFFgveie8fHLvxKNl4el1Xp8Z9X3vKe93PBhg0RNZhdg8PXs+x3/BNIHp8XTKVyefnnFLgai+cxPGPjhRY++U1xmM9nfJxOqin2oXtKnWwFPt+QbaIUcvgKhsirnD/cp6zg== 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=0C7mxnowOW0TmL7fM1yqAnLtlx5pSlWlf6Tc+/+emhQ=; b=MdWJXEuceH9s2+ReTU7VqfRfcjp0vzoGGOpnsnfTz+LfU5FdSfdGfTLJbHk6Ugw0eE66qa+q+mQM03jX/ATh2pxQFTgQjuLW2BcaaV0TKwTD1BYDZjzju6Z8rzCM0SzeGvLIXEJRlHQeR/vfYKsujC/KCN2Clxe8V5S1c3Hv/oj1TpHnG9tlzp86iMNwxvt0JA8eMeP3xteQUktYf8NS20WDnUzreJcvWWqv5+06M9L8aDV1ME6YTe6qkTr4jIQEaxoA9Lq26hORA8DXunp/IRHmxEhMX8rM9j9o39s8gydodTQIeOPnKtwB+4blDTOGMzHXXeDTuV4Uwnay/fIMwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=0C7mxnowOW0TmL7fM1yqAnLtlx5pSlWlf6Tc+/+emhQ=; b=oHPyxp8wOcfluuSBUZqj1M0YH3r/zlKcg40qD9QMLU2RCr1fXPRDd6yShFAZMaOnRT1l1qu9jJV72S3ZNcZ88UC5bL9x03QQs+KGvW7obRFU9f7EbkQKliLYNMAW4M9sn2+NDSJ1J/B6HXdKrmzel+Tv0TQK49c2R04eCITntIE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by MW4PR12MB8610.namprd12.prod.outlook.com (2603:10b6:303:1ef::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Thu, 19 Jan 2023 14:20:59 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a%8]) with mapi id 15.20.6002.024; Thu, 19 Jan 2023 14:20:59 +0000 Message-ID: <3d244b22-e496-53c1-655f-e34a787604d7@amd.com> Date: Thu, 19 Jan 2023 14:20:54 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH RESEND v2 01/11] ethdev: check return result of rte_eth_dev_info_get Content-Language: en-US To: okaya@kernel.org, Thomas Monjalon References: <20221122153053.1172434-1-okaya@kernel.org> <20221122153053.1172434-2-okaya@kernel.org> Cc: dev@dpdk.org From: Ferruh Yigit In-Reply-To: <20221122153053.1172434-2-okaya@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P265CA0145.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2c4::7) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|MW4PR12MB8610:EE_ X-MS-Office365-Filtering-Correlation-Id: 383e015a-f2e9-4bb5-b269-08dafa2862f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ckhLXdwCfKVlhbDHFpC15EePg/a3EY+lsZQlSj1TUW8sSQ8baDhvDAsqXkKzOooAaQnF2e7nstDhI5WsMxvoaBzKWgEFUxpV7ZKRrxTK3sV18SEsJ/ce2wRNXp7io4vI8BJiooUx8jZKtsRv7hh9+bAZnTOuOUQfTp2iwRffGiCojCuJEnoZ1GcWwBLs2Z/4s+oboiRLReMnPnT8sB8lgg8oaiCq9XocbDW5c2gcZZHvVOzkY8QZuYZ0hGvS2ce8toWPmk7JkWqjGURBo4oBBJT+w8o8H1jjd7VwfDXt7xcFFznvWAN/kaidB8ptULaJTtMKRU1PVLb2iMuVNho6dDxQR+yycjv/q1oqsETADTExH8skw7K18gCqliZVO9gmTjgGEadtb5QwMRrzJDnI9mu7On7W7ZTLMK1xZ+ldG2ZQkngkkZlkcjL9dZS0r8DMpdasIkVCItEJeCyb6m1XLFDpz/EVgGxgILVpGhz8NO7AAGNF5PTTDsrp4KAcF9BjecgPwcbY3HbiYlFraJ0xFOJ4nYhEF5iyoIVgY//zpMQYY7tclE23RAFwpD2qPQrfmRO4Zsa7cIE4c+2pTDpYZKzflQTCsblQbLhXVQmJqZdI2QQ44wmY2nUSs0ex8VsopZhWdqQ5u85Twrq0ycDf6oL7SycppnhAxQYLYWy5v6r3bixiflrJnswufEQ/AzCU8P0hwrzkzXvP9oQniyMk/cdaIukz0roB8+2gom8Nnv8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(366004)(346002)(136003)(39860400002)(376002)(451199015)(31686004)(66476007)(2906002)(5660300002)(66556008)(44832011)(66946007)(8936002)(38100700002)(31696002)(6666004)(53546011)(316002)(36756003)(86362001)(478600001)(6486002)(6506007)(8676002)(4326008)(6916009)(41300700001)(26005)(186003)(83380400001)(6512007)(2616005)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MU0xY0hqb2lMTDAxcWRRd3NLNWhxV2Z0ZkpGZDk2aHRSMDN6c2RUYXNKOVh4?= =?utf-8?B?QitzRld1Ylg0MlBqNzBzMTRlVTZKb1FhL1BoSEtXTnRjL0Z0WmVZelJjaERE?= =?utf-8?B?SWVacDgvUFlpMlJnRTBDVVBGcERMc0psekVyclhZTmxOQS9USmJiMzhBMWN5?= =?utf-8?B?djV0bkVadFNtQmRKVEdaTVkrVmxRYVgxS3dqOTdkY3JwUlpmYllTQTVCRms5?= =?utf-8?B?NS9mb0MyNHFUL2xESk93QW1kVnBNOEFtSGRsbWJhQi92ekExM2RmcjREd3J1?= =?utf-8?B?ZXRHTHlZTG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=?utf-8?Q?oefmO2IpIzzcJE8kjJWG3MsO/?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 383e015a-f2e9-4bb5-b269-08dafa2862f9 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 14:20:59.5181 (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: RIM5EbpMMf79dn9qzgj2RDvYv5+hQMXERvC5RxE5MLnKQWPk19YRJOlqSVCrWN8R X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB8610 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 11/22/2022 3:30 PM, okaya@kernel.org wrote: > From: Sinan Kaya > > rte_class_eth: eth_mac_cmp: The status of this call to rte_eth_dev_info_get > is not checked, potentially leaving dev_info uninitialized. > > Signed-off-by: Sinan Kaya > --- > lib/ethdev/rte_class_eth.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/lib/ethdev/rte_class_eth.c b/lib/ethdev/rte_class_eth.c > index 838b3a8f9f..8165e5adc0 100644 > --- a/lib/ethdev/rte_class_eth.c > +++ b/lib/ethdev/rte_class_eth.c > @@ -51,7 +51,9 @@ eth_mac_cmp(const char *key __rte_unused, > return -1; /* invalid devargs value */ > > /* Return 0 if devargs MAC is matching one of the device MACs. */ > - rte_eth_dev_info_get(data->port_id, &dev_info); > + if (rte_eth_dev_info_get(data->port_id, &dev_info) < 0) > + return -1; > + > for (index = 0; index < dev_info.max_mac_addrs; index++) > if (rte_is_same_ether_addr(&mac, &data->mac_addrs[index])) > return 0; Minor issue, but before patch, comment about MAC address match applies to block of code that gets dev_info and does MAC compare. After patch, get dev_info is separate code block and comment doesn't really apply to that block, although it is possible to understand what comment is referring, still I think better to move it down to the block that does MAC compare.