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 6E63645CFC; Thu, 14 Nov 2024 02:54:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A61E1427C7; Thu, 14 Nov 2024 02:54:23 +0100 (CET) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id E9F34427AC for ; Thu, 14 Nov 2024 02:54:19 +0100 (CET) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-7e6cbf6cd1dso29487a12.3 for ; Wed, 13 Nov 2024 17:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731549259; x=1732154059; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2tsrXVjNCohTLgxutvP31wdAWrc+mpxQtGWs49kj2NU=; b=rUF5aTiec5BAwoUacJ50LkaVDlHQtxXBOgonMxTFoYKEpKRTCcXZg2PPmZD+84/v4s UooP6CjrGZ2cZjQr8+mFJ/OZtcwctEFN8SpAFxWxg2uVu6Eqld0ECTxZKAlJWzeU9haq xyb+mO7xFL7iBLGSiewB15MXH3sa9gbuO6RU+4xZiZY84E81GI/XaqBHQq5moA+walwq 2x4zx0vLPCFnqGe8M4w7z4OZO+17NmKiOrNGBH7NlkSgNUKilgKQp3gxds/FPFyB85Tj RjAvuooVzF5MGGWXWSsm8bHPVqnWrO0MMu3NkhQYo7cDNY8Ltb4er4grSJpSECZ89ePZ 5lZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731549259; x=1732154059; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2tsrXVjNCohTLgxutvP31wdAWrc+mpxQtGWs49kj2NU=; b=IotVikgcQwALuvOwbTjjvCd+k0yZy9pzEpfilZ/fkzx89gGt+j3dv/YwdrGysqdcRx sIcryAW/MTnOex8bt1zKkmFM7t2R6HsssC3S0cu6InU0BHQJyWeJdHqb/GxfU3i0N2SX nke3uXiP8c7azVgriYCtI+MBC+efplaGCUpPc5CtAD+8aUQJTdLe40UVtmIsFX/pCh9i KGy4kfdZUVuQKZqcpS/bp2BpV1T4weGXLE0htgh5u62BM3zw1bDLzNlk8Z7doFvLVFFN xpR6URJvlMXwMPRBFcX/fAbez1/NkYkf2bg4O7eMm9n3vQptOrTdYziJ17pd1xoyE6tv UwSw== X-Gm-Message-State: AOJu0YwxIBF9N3pE85JkNLDurJFzpbSJqA3Ut2hXpFfRUx1CM5hRAWsG j+Y1kLbmK9Ny2DFHFN1m8LGkm14ZvNpijaj/0QC1ngOgWvQOvVibSB39wT38xCIHtCU3xr2+nK4 W X-Google-Smtp-Source: AGHT+IEbdU8m1xPLaq+UR0pLUVFDOA/AhgjaWYim/J3ubDxL5y6bi5K20zfbUr6oJU5GsLtjon+PJQ== X-Received: by 2002:a05:6a20:4309:b0:1da:4dea:3a41 with SMTP id adf61e73a8af0-1dc5f8ce2a7mr12380972637.5.1731549259143; Wed, 13 Nov 2024 17:54:19 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea02496eedsm210050a91.18.2024.11.13.17.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 17:54:18 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org, Kai Ji , Ciara Power , Fan Zhang Subject: [PATCH v2 4/8] crypto/qat: fix size calculation for memset Date: Wed, 13 Nov 2024 17:52:18 -0800 Message-ID: <20241114015405.77060-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114015405.77060-1-stephen@networkplumber.org> References: <20241114011129.451243-1-stephen@networkplumber.org> <20241114015405.77060-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The memset was always doing 0 bytes since size computed later. Link: https://pvs-studio.com/en/blog/posts/cpp/1179/ Fixes: 3a80d7fb2ecd ("crypto/qat: support SHA3 plain hash") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/crypto/qat/qat_sym_session.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 4b4e9ccbab..8915307c1d 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -2347,7 +2347,7 @@ int qat_sym_cd_cipher_set(struct qat_sym_session *cdesc, return 0; } -int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, +static int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, const uint8_t *authkey, uint32_t authkeylen, uint32_t aad_length, @@ -2620,27 +2620,27 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, break; case ICP_QAT_HW_AUTH_ALGO_SHA3_224: /* Plain SHA3-224 */ - memset(cdesc->cd_cur_ptr, 0, state1_size); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); + memset(cdesc->cd_cur_ptr, 0, state1_size); break; case ICP_QAT_HW_AUTH_ALGO_SHA3_256: /* Plain SHA3-256 */ - memset(cdesc->cd_cur_ptr, 0, state1_size); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); + memset(cdesc->cd_cur_ptr, 0, state1_size); break; case ICP_QAT_HW_AUTH_ALGO_SHA3_384: /* Plain SHA3-384 */ - memset(cdesc->cd_cur_ptr, 0, state1_size); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); + memset(cdesc->cd_cur_ptr, 0, state1_size); break; case ICP_QAT_HW_AUTH_ALGO_SHA3_512: /* Plain SHA3-512 */ - memset(cdesc->cd_cur_ptr, 0, state1_size); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); + memset(cdesc->cd_cur_ptr, 0, state1_size); break; case ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC: state1_size = ICP_QAT_HW_AES_XCBC_MAC_STATE1_SZ; -- 2.45.2