From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64A63A04E7; Wed, 4 Nov 2020 08:16:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8E637C7F4; Wed, 4 Nov 2020 08:16:26 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60071.outbound.protection.outlook.com [40.107.6.71]) by dpdk.org (Postfix) with ESMTP id 5F6CDC7F0 for ; Wed, 4 Nov 2020 08:16:24 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ELb8XaqKcigb/+PD1+LbuxwHpreIPY37lxZ/p5mdDF7ZJQDfLO8uJgQ+ZRVussCOrPSB0PeWNI8f02cZjuseLi2ZFUh4Lp6dLznnjiMoOxxMrRywpEyQEDbRYvIfNLCl0Y1aZQlAXrnk1XChl31rl9WstsjyKlMim+BouGkHr1a/vgicXJbUHtO0u7DDzTQuZV1nZAdPJpXXP2w39wNO0Hv7bsfxROnq2Q2R7zv3hnXWPpH5b+XIV/8n8R1CNkSpbzOMUZvf8S5NI2NYwPvPkTezyVaDqoautdG0tgWF+Our3AJecjaFOzrrO6CtuMQo8ddahWh9M+3sfkeJRX93jg== 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-SenderADCheck; bh=UwVJGQIm8xXLG5a6whYdGK6wCfihMIBg44z1PsubcYM=; b=XqsUYowXV6RdvLhvXpCDHvF1NC4ySRB581le8F5130kZGI2LbSVb1TMvjyAo/GsIA/a96bcxQYj5DNnPNHUDos8JPv68fh81AXQwzAjy2isnYoOZ1Zr3o9bJOetoN72y4wgvorf9gpUl0P3mWVCtFaCcbc+QhNyuS6QFAkoRf0G6OcEdGx0BjVDtA7Bm/SkibeI0KyR3Udza1McH7+rH+ChksKswuXKVu5tAyK/b6WqFaVqnq3HC4pWR7iVgb6Xvvrv1weN6QAAo8KJmSwDHFtQcKXoutZaD5ZE9GfzCFJq5FK+UeYEJwgCYjBkQJNyHx0Q9uNDPuXS72HDXxpDmOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UwVJGQIm8xXLG5a6whYdGK6wCfihMIBg44z1PsubcYM=; b=HAltyV7mTVA09FPB8PcvbChK1JJCee+TGDL35/D/uMXgAKuP0xrWPSAS5bC0ZFEVwwxV7mLQBNWjW7DkU2oN2QpXSG3XLIELZJ0B5t56Sy3FtVGwM2Cy9q1g4JyODDpNUU9PFoxkus5ACi09ANJO+bAgepLWegBQMfSjPtPlg4Q= Received: from VI1PR04MB3168.eurprd04.prod.outlook.com (2603:10a6:802:6::10) by VI1PR04MB4366.eurprd04.prod.outlook.com (2603:10a6:803:3d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Wed, 4 Nov 2020 07:16:22 +0000 Received: from VI1PR04MB3168.eurprd04.prod.outlook.com ([fe80::9513:3b55:931f:216e]) by VI1PR04MB3168.eurprd04.prod.outlook.com ([fe80::9513:3b55:931f:216e%4]) with mapi id 15.20.3499.032; Wed, 4 Nov 2020 07:16:22 +0000 From: Akhil Goyal To: Ciara Power , "dev@dpdk.org" CC: "roy.fan.zhang@intel.com" , Declan Doherty Thread-Topic: [dpdk-dev] [PATCH] test/crypto: fix null dereference for crypto op Thread-Index: AQHWrr43l52krVoyxk2FK+9AO6KX9am1RFfQgAJR6xA= Date: Wed, 4 Nov 2020 07:16:22 +0000 Message-ID: References: <20201030131126.222553-1-ciara.power@intel.com> In-Reply-To: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [92.120.0.70] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 170e2f93-df05-4969-fb01-08d8809188a7 x-ms-traffictypediagnostic: VI1PR04MB4366: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ly6Zhd/ru0S2IkIUaZYOO1XMdd6piUyAVtnifhX4/xbDsAFe2Leu7cRpnrFWS2lluV7qpbD72YyUGq/x3A/SOeJJDuxYBErDH1JvO1BMi2ijg+hidPc8e6UyxrrukP4U+E1oR2BdhU3K2TcMmyh1HXsGO5Ee2sclYFfbKT45ed1sLoghjqmIlGvv1fezhG0J8TZIiJ0LjIBFvK3tkYXain9wTfbL3sCjfMIofVAEEjNLkCKNhJV2lsC5mzGHTKVUIHM88N9giFOVR7y0189QDbm9pwCuJReAIZLFPbnkS1FMxkgEPVTacJi9iyBk/mL9 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3168.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(376002)(346002)(39860400002)(366004)(54906003)(52536014)(110136005)(76116006)(26005)(66446008)(66476007)(186003)(86362001)(4326008)(64756008)(66556008)(66946007)(55016002)(8936002)(9686003)(478600001)(5660300002)(33656002)(83380400001)(2906002)(316002)(6506007)(7696005)(44832011)(71200400001)(8676002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: lI5l1Tn+BbgQOBvsYGWWVKThKdEMZePC7lGPYL6TVout2HmFeFIENMST10PzouS/NQesJaMcbrL0nlkL7pO/bNwENcsfjYw5CkTDMENN1zZDwxLGN2u3W3M5ewG+oZ+Hvilp3WfgXOgyeHN8ZuGd6e9AyBy+5hM+PJuKXly34hjLVPxZBEZBQUuQN4xM+oeqoi7RmOmfwdPXeqmz3iTNwAWCE0TOrAjTFLPIdnhTurSO77+5+cIs2YJt5LW5zogVSDr2rZFVQ4eRsy5daszMhi7006lD99KbxvDAPqz1MhAwpYX3wfI5oryoxaniqZk5DlnZ7GH9i8p3kbX3/FRzYjqHlnSFBh2mXf/O9jGw//jm7GbRkdg+DOeAH2QPAC54tnHxfsVVj26MJNDJFkRu/wt7tRJVWlCzBuDTVcugYXjIUAgTxNU3kSSHiTjbwinKdAqbDsHPg5Gs2P6m5uCqo5o8I6I0XysbTpwEyf4j7ycdHcxzJm1CpSoN+6wQCEEZPDoiMjKm0Zh/cXEeOp+ilRrUJ3qGVM5rUiqas82doIMBJRVGPLehMoxrOXdzpnsvorAMZgHWLOoLDcVjacscICQ8YHGANa+jsilKvTUh7QQUQ8yAtYMDk+6SjHPn7KrAuU9LzS7dxksMqRoBpIl8PQ== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3168.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 170e2f93-df05-4969-fb01-08d8809188a7 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Nov 2020 07:16:22.3449 (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: cYGqTXR32hyWRuamh3N+IQIASJMgJ1wUqRoGFpiz027iNxHKzQNQN6bzDbLYhu4q5Y5fklgrzzRiJnOVAwZRgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4366 Subject: Re: [dpdk-dev] [PATCH] test/crypto: fix null dereference for crypto op X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > > Subject: [dpdk-dev] [PATCH] test/crypto: fix null dereference for crypt= o op > > > > In two test cases, the op value is set by the return of the > > process_crypto_request function, which may be NULL. The op->status > > value was checked afterwards, which was causing a dereference issue. > > > > To fix this, a temporary op variable is used to hold the return > > from the process_crypto_request function, so the original op->status > > can be checked after the possible NULL return value. > > The original op value is then set to hold the temporary op value. > > > > Coverity issue: 363465 > > Coverity issue: 363452 > > Fixes: 4868f6591c6f ("test/crypto: add cases for raw datapath API") > > Cc: roy.fan.zhang@intel.com > > > > Signed-off-by: Ciara Power > > --- > > app/test/test_cryptodev.c | 14 ++++++++------ > > 1 file changed, 8 insertions(+), 6 deletions(-) > > > > diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c > > index 0fed124d3a..ce8bcd1d4f 100644 > > --- a/app/test/test_cryptodev.c > > +++ b/app/test/test_cryptodev.c > > @@ -6676,6 +6676,7 @@ test_mixed_auth_cipher(const struct > > mixed_cipher_auth_test_data *tdata, > > unsigned int ciphertext_len; > > > > struct rte_cryptodev_info dev_info; > > + struct rte_crypto_op *op; > > > > /* Check if device supports particular algorithms separately */ > > if (test_mixed_check_if_unsupported(tdata)) > > @@ -6771,17 +6772,17 @@ test_mixed_auth_cipher(const struct > > mixed_cipher_auth_test_data *tdata, > > if (retval < 0) > > return retval; > > > > - ut_params->op =3D process_crypto_request(ts_params->valid_devs[0], > > - ut_params->op); > > + op =3D process_crypto_request(ts_params->valid_devs[0], ut_params- > > >op); > > > > /* Check if the op failed because the device doesn't */ > > /* support this particular combination of algorithms */ > > - if (ut_params->op =3D=3D NULL && ut_params->op->status =3D=3D > > + if (op =3D=3D NULL && ut_params->op->status =3D=3D > > RTE_CRYPTO_OP_STATUS_INVALID_SESSION) { > > printf("Device doesn't support this mixed combination. " > > "Test Skipped.\n"); > > return -ENOTSUP; > > } >=20 > I believe the original check was also good. But instead of > if (ut_params->op =3D=3D NULL && ut_params->op->status =3D=3D > RTE_CRYPTO_OP_STATUS_INVALID_SESSION) > it should be > if (ut_params->op =3D=3D NULL || ut_params->op->status =3D=3D > RTE_CRYPTO_OP_STATUS_INVALID_SESSION) >=20 > In this way the coverity should not raise an issue for this. What say? >=20 Please disregard my comment. The patch is good. Acked-by: Akhil Goyal Applied to dpdk-next-crypto Thanks.