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 DE693A0C41; Wed, 15 Sep 2021 16:48:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EF4E4068F; Wed, 15 Sep 2021 16:48:01 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id EB3A04014F for ; Wed, 15 Sep 2021 16:47:59 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="283340410" X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208";a="283340410" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2021 07:47:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208";a="651227684" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga005.jf.intel.com with ESMTP; 15 Sep 2021 07:47:58 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 15 Sep 2021 07:47:57 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 15 Sep 2021 07:47:57 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 15 Sep 2021 07:47:57 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.43) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 15 Sep 2021 07:47:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eZJm9+95dfuTD1zLP/YajJ1nYw4mw6AqH4NDhFXeiFSGkYR0ApJVrj/WoYHoPCVVeGoDGIoZapU8XHczRkDTexX0JWUe7MxylwxyVVZceVPKwLx4/3QQioXX2LJVNFBmtEWJ/9lnGbqqIJaqKZvI275COa8hXiQEjAeKdXX7x2n4sA7He0WlhL7hUgIg7hO9Ex9LxyC42wk+vBzvig5ofcrfvhcpqk8uyDHrGq0fwWzEBgG/76COOdz1v8sNgSwC5AFNUzIKfLfaOvMv9RPYF9aGA0QR2p/cOa0ZP5BVlmXzgTZ50IVLgx6kSof3PfZQKalhY8Qb7qFYKtsjaUvwTA== 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; bh=55U69V0yfiYhBBHzm+N9pVLfwLSASiTEv1sxkqcNKho=; b=GNwDdEey7S1oPVkx+K9K3E797pn8E1z8U3qqIf9XVM5hhtDpqpCn5DXoGomruQIAPBjoYxA5dkFIcH8BlZKQ25RVmbuuWS+5PtCyMnEUY0XrW5T4zwhzuMqdHePHcA0xEsDfm5m9VArzLzf4d5CcVRWNC3NvKdyksqjESBRU9i+U+o27XvxiWGoSZ8Zx4Svxf9poJmwbee6ayiQ7/a1Nc8qSGiAtiNrIi3vtaFY4iNLBMOzydcLT/hLT1j61iCqaRdIRenCKbeg5TtEcA50tNwQrAwL9I/5+BhsuYzkdJ1cKzJyjYY5Qk83/sbZtj01haaEON+FuCEE+KDqX2vBRog== 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=55U69V0yfiYhBBHzm+N9pVLfwLSASiTEv1sxkqcNKho=; b=OqGsRYAxPJV6NeFxmIOmFvQR1yhfcwh1McUMjM7w+vEqNj2L0asNeuENSDikWkFVF66B39H9mFBv2MAJwQllXZy7oqwdDSsLgv1Zqox1jsPKDXx1zB/P1xZlc6n/bqQSKmNacBCFdqx5xwrtk7/FUrS9bol7zDdzR4qoHkw+4QI= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5055.namprd11.prod.outlook.com (2603:10b6:a03:2d9::10) by BYAPR11MB3269.namprd11.prod.outlook.com (2603:10b6:a03:75::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 14:47:55 +0000 Received: from SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::78d4:6f82:aa87:c271]) by SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::78d4:6f82:aa87:c271%7]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 14:47:55 +0000 To: Bruce Richardson CC: Chengwen Feng , , , , , , , , , , , , , , , , References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com> <20210907125649.49794-1-fengchengwen@huawei.com> <20210907125649.49794-5-fengchengwen@huawei.com> From: Kevin Laatz Message-ID: <9fdc2c82-fec4-6401-6dc9-54e562718340@intel.com> Date: Wed, 15 Sep 2021 15:47:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: DU2PR04CA0314.eurprd04.prod.outlook.com (2603:10a6:10:2b5::19) To SJ0PR11MB5055.namprd11.prod.outlook.com (2603:10b6:a03:2d9::10) MIME-Version: 1.0 Received: from [192.168.1.15] (109.76.76.227) by DU2PR04CA0314.eurprd04.prod.outlook.com (2603:10a6:10:2b5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15 via Frontend Transport; Wed, 15 Sep 2021 14:47:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aaf2236e-195b-44e0-c56c-08d97857cd5d X-MS-TrafficTypeDiagnostic: BYAPR11MB3269: 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:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i/p3bfUYBoZd0QbpKfo1fzvuMWgMoOwDK9MazpR4Z5L/98ddzkAIVK74Y91r1n+QJPwGgJDC831+STckYcRjo11ILMlKfJkdngzLGGI8Zp7KMNpbbHeDpiRzKU4hVHJ3c4Cq8SMMK01NMmm/9qpVVlAlNoeBWw2rCrh6UjxpAGdiv25yvxxRTyZdkZV7pYDT1V3oFxFDdmtB+gR/3VMvRd1u2PNx9VTlC2I5j32iG31kU6hjMBXI6wqcz8F9YPoganY1XArkhNHflCZ5tjWAO5Weg9LX79xo9FXSAfQfT+G5Xn8XSBoDZZajo2s9o20avtDmTocYdPwZHJSc/KW58xB7tXlaIYRfF38Xh6SQPPI5N5sdK9k8JZ+D/sVoSNkZAGW+oWVGEpE7pC64PkN3NGGQCOGOgPbyptxPmg6XeHY3PTgjL6Sp2x4JCp2s9LQ50cRzvMDtnPG90W4TmTQBT8GJtTPJK66g9eox+4akbgoTHfWYbHtrJthq8qlIlR7hbO3PzYp3rZrvqg4mEGnBRm1+Jvx7rvWW20sY/MOt9ynyrUhwtu5S6orwafGIoOcoBSXARjw2ABNcGPaYwOAldZfB0hW9+gU/LHw+UCShmlj5onwz+H51ktZFWijxkvmp/iJmCN/PojfxcoLuyqTcvAVqim48JkDjW4WOJvq3FP3OcLT8S/pZf0dCgGs+3EvmtmnZyR2+FUTuJSz31l8HvTWbNTxX7HdBjpy3bF8Pm9KGe8XtdpeIQgaExeFmKYTJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5055.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(31696002)(6666004)(186003)(316002)(53546011)(6636002)(8936002)(7416002)(478600001)(44832011)(4326008)(6486002)(6862004)(956004)(83380400001)(36756003)(2616005)(2906002)(38100700002)(86362001)(107886003)(8676002)(66556008)(66476007)(26005)(66574015)(5660300002)(66946007)(31686004)(37006003)(16576012)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aDJjUlpBaDJsZHZncVFGZXhNWDhhaGVCV1pGSk5VNmhSZ0JaaitqbzhZakpo?= =?utf-8?B?cWtGM2xXb1VtSTNkOEpJSUgyTWx1NXU1MWRxQkR6bXRJMjgyQ3Fkd0lvd1N1?= =?utf-8?B?S3lBMDRJdGVnVFFxWE9EWUM3Z3RwNWNFZ1J5UWFpT2NMb1BVVmNNNjM4THVT?= =?utf-8?B?dWcyWUl1V2pNOVRQNXlER241U2ZES2drWkZIU2o5SjRaTHZacG9KMlYzaGZz?= =?utf-8?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=?utf-8?B?d1hXWnc1MXlLaHZtQVg4Y2t0ejhvSVZMYzUvdk0yYUp6QXR3b0xndGF1NUNQ?= =?utf-8?B?VXpXS0pCbGlubzhWUkNTb3NISlY3Z2U1Nk9BbXFudkJhOVJQZGpiYjhZditZ?= =?utf-8?B?QUNrVnBaOGhEK0Q4T1pwTy9wMmJCTWVyVWF4TElSdHMvNlhtUWhnWHRqZGlQ?= =?utf-8?B?NmVjRFNSdDZsckpDOHA0S2hCRkEwaXpHU3Btc1VzZ2RmckJ4NHMrSk8wT2lj?= =?utf-8?B?MTNsN1BRMG1Jckhtc0FwaGc3bUVoWGpOOWxkUnhrQmtlZjBpVjNnSWRxYTNk?= =?utf-8?B?d2I0RnI3cDB2SXF2eHF0TEk5ZG5kNnNOVW9sVVV4bHVmdHdzYWFicnFvSmF0?= =?utf-8?B?ZDc4VzdYMk1uWUowcGdJQVFKdm5ORnNYaTQ5T3cwelJMS1pyMll3ZGZ4bXNi?= =?utf-8?B?czdPZTlHRnJ2OHY1N2tSU0dkWkNXZmtxSXVHVnV1amJYU2FKeDZuUW1lVWpl?= =?utf-8?B?ZWZIV2xlL1BQOHgvaVlnV1RiSnBkY0dDdUR5V0ZWTVFhQlFSbExPeU1xZUZn?= =?utf-8?B?R0dXUkdMRGZmOW9HZjhBYk5UdnF5YjZPOEswMDJoNDBmTFZzTDA0TnhLQldo?= =?utf-8?Q?D96kcJCX5Vcim2m8Mg13PM03ngCk2Y4uMOsrqmC?= X-MS-Exchange-CrossTenant-Network-Message-Id: aaf2236e-195b-44e0-c56c-08d97857cd5d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5055.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 14:47:55.4639 (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: 3wiT3HtumJIkqatxA2a2BHT1LS8FruxdogmUjvkCykclLGmWKHgdG3BQHHsyXj8mL+zCk/psg0+Hf/wk4yEjSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3269 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v21 4/7] dmadev: introduce DMA device library implementation 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 Sender: "dev" On 15/09/2021 15:34, Bruce Richardson wrote: > On Wed, Sep 15, 2021 at 02:51:55PM +0100, Kevin Laatz wrote: >> On 07/09/2021 13:56, Chengwen Feng wrote: >>> This patch introduce DMA device library implementation which includes >>> configuration and I/O with the DMA devices. >>> >>> Signed-off-by: Chengwen Feng >>> Acked-by: Bruce Richardson >>> Acked-by: Morten Brørup >>> Reviewed-by: Kevin Laatz >>> Reviewed-by: Conor Walsh >>> --- >>> config/rte_config.h | 3 + >>> lib/dmadev/meson.build | 1 + >>> lib/dmadev/rte_dmadev.c | 607 +++++++++++++++++++++++++++++++++++ >>> lib/dmadev/rte_dmadev.h | 118 ++++++- >>> lib/dmadev/rte_dmadev_core.h | 2 + >>> lib/dmadev/version.map | 1 + >>> 6 files changed, 720 insertions(+), 12 deletions(-) >>> create mode 100644 lib/dmadev/rte_dmadev.c >>> >> [snip] >> >>> /** >>> * @warning >>> @@ -941,10 +1018,27 @@ rte_dmadev_completed(uint16_t dev_id, uint16_t vchan, const uint16_t nb_cpls, >>> * status array are also set. >>> */ >>> __rte_experimental >>> -uint16_t >>> +static inline uint16_t >>> rte_dmadev_completed_status(uint16_t dev_id, uint16_t vchan, >>> const uint16_t nb_cpls, uint16_t *last_idx, >>> - enum rte_dma_status_code *status); >>> + enum rte_dma_status_code *status) >>> +{ >>> + struct rte_dmadev *dev = &rte_dmadevices[dev_id]; >>> + uint16_t idx; >>> + >>> +#ifdef RTE_DMADEV_DEBUG >>> + if (!rte_dmadev_is_valid_dev(dev_id) || !dev->data->dev_started || >>> + vchan >= dev->data->dev_conf.nb_vchans || >>> + nb_cpls == 0 || status == NULL) >>> + return 0; >>> + RTE_FUNC_PTR_OR_ERR_RET(*dev->completed_status, 0); >>> +#endif >>> + >>> + if (last_idx == NULL) >>> + last_idx = &idx; >> Hi Chengwen, >> >> An internal coverity scan on the IDXD dmadev driver patches flagged a >> potential null pointer dereference when using completed_status(). >> >> IMO it is a false positive for the driver code since it should be checked at >> the library API level, however the check is also not present in the library. >> >> For the v22, can you add the NULL pointer check for status here, like you >> have for last_idx, please? >> > I think the check would have to be different than that for last_idx, since > the status pointer is a pointer to an array, rather than a single value - > which procludes a simple replacement in the wrapper function that the > compiler can inline away if unnecessary. > It's probably best to add it as a check in the debug block, with an > error-return if status is NULL. +1 /Kevin