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 1A001A00C3; Tue, 18 Jan 2022 10:59:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A082A426FF; Tue, 18 Jan 2022 10:59:51 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id C5EEB4068E; Tue, 18 Jan 2022 10:59:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642499989; x=1674035989; h=message-id:date:to:cc:references:from:subject: in-reply-to:content-transfer-encoding:mime-version; bh=1QjjULamtQGW9iYnqCBA5hBZUg84vQxkrriw4p2IW50=; b=iX3ZiassKL2HxE0FZJBx93wqcWo7Uyi4bOfR2D4UIiR7inoqoz4k/eik G85lzFTVktNtU2x4turKvzjKd0NijeYJLGewibeow+hHctnW6zLChQ5q8 l5aUHKNDzTAuDHsf9ZDilnoTAp2zt2JEKJhObu6y6lH3J2T4Htsy/sYj8 PhABQH2OaXbzmr8XD4gTQRIlAJn4FTXg5zzXtd95h12fwTy+/lIsXO/ya F+ZLceZzgIQPQcEWeC+LsfT73lGSJAwlertcTSwb6cLZq6Y7kgb92sWkI hldvAEgaA/SNIL2/EXydqR3GTgLqsXpPt9Zgav4My3pYvXggXpMf3JsXp Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10230"; a="308116775" X-IronPort-AV: E=Sophos;i="5.88,297,1635231600"; d="scan'208";a="308116775" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2022 01:59:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,297,1635231600"; d="scan'208";a="531718374" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga008.jf.intel.com with ESMTP; 18 Jan 2022 01:59:47 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 18 Jan 2022 01:59:47 -0800 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 18 Jan 2022 01:59:46 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.2308.20 via Frontend Transport; Tue, 18 Jan 2022 01:59:46 -0800 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.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.2308.20; Tue, 18 Jan 2022 01:59:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TLPrl/yTr6XoC6XuMd3MahMrptjP0Y+jFPRk/HbfMwYIF65Qn4bIS9i4NdcIOvdIqqF6KL1hp9L+iN1xWCth6b57iYfj7fJXpDVT0KMSpgaROFH6pXW4/5+RQgdc91lKBcWiXZLV3dfVM1PXLqe+lQWYmMVLboCu7m1kb1F8sRU1zLpb9aF1/0u9MCsiS3UYOFq/Vb0kVNCJn2dVaB9ia1GuY1aVAzHxtHqn2hI3YTPk2brqXG6xcPPAyzZkbgYu9Om1FpVg3VGvR+RHUsTcLb0hUzukim44GTJdJgJYVjk6fuEoR5vAc7X35d+2qPHLIL+FY8yLVgQqJlQcptEseg== 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=UT+dhzIAd/rhn4Q6/5V8oPsua3YXgkSmX51N8EuvuXQ=; b=k+MFsFXfb7po1ZkeUe8Q/AA2yNdNS8xt67F6YNeRBUnIIU0UQ0FwnDOEreJOifLJGN83d2hAhhzBMf4wtnSAu5iaGQlPOrdCexTqxDkE5sAmE9C3ctXYXTjCkxuqLh3gVM8SydbyZ0aYbCYZzX8G99RVDDPr6B/hcXEDQgfbqDwPZOR0FpOR/9dgwnEIncQkSrBBNh/Ta6nSkkwL+fUkSv+ZOLli/r5TiomG4CAH7DaiJbyNmzDLNgIg6ZHADBKU47xrX3eCeLqYwWNkRmdjsN8nMlF1pePApv/PJSQFQ/rKBT2w6c0FtfsCQl+yTxC+k4Sj9riFXmRKXnMxh/5A6A== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by SN6PR11MB3485.namprd11.prod.outlook.com (2603:10b6:805:b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 09:59:45 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e%7]) with mapi id 15.20.4888.014; Tue, 18 Jan 2022 09:59:44 +0000 Message-ID: Date: Tue, 18 Jan 2022 09:59:39 +0000 Content-Language: en-US To: Sean Morrissey , Ori Kam , Xiaoyun Li , Aman Singh CC: , , References: <20211209162727.12295-1-sean.morrissey@intel.com> From: Ferruh Yigit Subject: Re: [PATCH v1] app/testpmd: fix dereference before null check X-User: ferruhy In-Reply-To: <20211209162727.12295-1-sean.morrissey@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0413.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:189::22) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd4ea3f9-f515-4f19-153f-08d9da6940e9 X-MS-TrafficTypeDiagnostic: SN6PR11MB3485:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n/KRXwgyJzlFICMqQ7vGFtcJa5ZYYETCixwye2QglfSoJku4jFANtpq7Zk8ukB/vZjPDheBit67IMtrRLV/yttSjNnhKkg/eU3iNVvR/DJs+O6mm/U/zZfjMZMpU1KNeT2qzAGIY1Ta63pcgDkVFszpElzGH4pb7GKP/pmBApJrMYL7pEIffOW5K4ZgMFo8LgJbs3QIsNVaNvjRPzR2e0f1GKO6nO/HT43rR/4Dd6XftQ0CdiMBf4sFqMGNULrd2C/nQOR2ToTt7QnR2ZC9Yco2bKkp/zPLxOk6Z51C9M8XRl7opGtl8/cbm2nzUEix6/k8XHgoSzXQzu2611JJDds0TED2MPl4iENLWBsiUuZycOAbfOHMBP4vw9kt0VFqSAtzOAramMcrVASMEn93F0E7OkSnzgjhcoBvuG95nKRxfzDhqbXCjMbJ7MJMme6EsCy79NneWt+u/9IBLsc1Iu0OUQfqPYaE1Or7PBzbC2djzRsBhKQ6xSf28FgYrB9mdOtAh6A7KOWAM703VHQXxiZ4fZ15xbKKTJQcIjW6xNYXQhAqb2DVFRnn0i6ZHjrJC7Zu+TK47fSeNQzsdMrMjh9Sp38IdRSt7qm5aNFOSneIslQf4tU/HUjWUQSCL4vNSDNguzSGq742yw1Q8VMw6MZ4LlI4YBNmJETqq0WQZll+zG3Gu8rzZ3NMfJiewqsbU9Xev2v7MmIwbktUX/XqE4g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(66946007)(6486002)(31696002)(5660300002)(6512007)(86362001)(508600001)(2906002)(107886003)(31686004)(6636002)(44832011)(53546011)(26005)(186003)(82960400001)(8936002)(6506007)(36756003)(8676002)(2616005)(38100700002)(83380400001)(4326008)(316002)(110136005)(66556008)(66476007)(6666004)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?czBJU0NZclFhakZIeFF5YnpQVUFWLzA3cFNjZkxONWNWSnNzNm4ybWRkRmho?= =?utf-8?B?RkJaTjF3Sko4TEgwT0ZnWFBUbElmZEs5czVhUFBLRDZjSHdiN0l4d3l5M2Jp?= =?utf-8?B?UjkvdUZnaHJPRGNpQVVWWERoMEZLcmZJQyt1Y2g2VzlwTkE2aWhHbGxZTjAx?= =?utf-8?B?aVpxUzlVaitaeXZNdHNlSWpwR09EWGVwWDNqYVMwNCtUa1RYUEUwM3JTL2R6?= =?utf-8?B?WlhxRjBNSWIyZWUyU1FuWWZscnZxSURqZ0FQd2VqZXoxWjMza1IvdDBQOWdH?= =?utf-8?B?Z05iYUJWOVpyMTJENFBhYUhVRVQ3YWxDUmxnaDNpZFpOeG9tYjhYb0c0ZTl1?= =?utf-8?B?K2RLYzlmUTZqKzFnK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VFL?= =?utf-8?Q?2MzIUY25X7hQHRd4DNeTKRY=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: cd4ea3f9-f515-4f19-153f-08d9da6940e9 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 09:59:44.8042 (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: UfR4AY644h3qb0ObaGSqGqPaM48acRsl/ukGWsoKA00VoIQuhqq1ESKyPgRmcGDOlwHh7rRukh+Ne2EozkSj2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3485 X-OriginatorOrg: intel.com 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 12/9/2021 4:27 PM, Sean Morrissey wrote: > Assign 'left' variable only after null check on 'size' > as function returns if 'size' is null. > > Coverity issue: 374381 > Fixes: 169a9fed1f4 ("app/testpmd: fix hex string parser support for flow API") > Cc: stable@dpdk.org > Cc: wei.zhao1@intel.com > > Signed-off-by: Sean Morrissey > --- > app/test-pmd/cmdline_flow.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index bbe3dc0115..5bb7abcced 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -7702,7 +7702,6 @@ parse_string(struct context *ctx, const struct token *token, > static int > parse_hex_string(const char *src, uint8_t *dst, uint32_t *size) > { > - uint32_t left = *size; > const uint8_t *head = dst; > > /* Check input parameters */ > @@ -7712,6 +7711,8 @@ parse_hex_string(const char *src, uint8_t *dst, uint32_t *size) > (*size == 0)) > return -1; > > + uint32_t left = *size; > + Hi Sean, Change looks good but can you please move variable declaration to the beginning of the scope, like: uint32_t left; left = *size; With above change, Reviewed-by: Ferruh Yigit Please keep the tag in next version.