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 06B5745CFC; Thu, 14 Nov 2024 03:38:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1788E427E2; Thu, 14 Nov 2024 03:37:57 +0100 (CET) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id 27B3A427AC for ; Thu, 14 Nov 2024 03:37:53 +0100 (CET) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-7246b04f261so47129b3a.3 for ; Wed, 13 Nov 2024 18:37:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731551872; x=1732156672; 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=21xnoCfaPpesGzf+oyhhRlot/F+Lteg+nAvr3qsjeC8=; b=1ZaF2Cdmg6env9tI8gYqR+ku+/zW6uujQEez9qGK4bwhd4dr4m3HfDYLU9UI45wqwT E7rSjNk+RAo1IQ8yxXrrhhOABy9KV/ZetI9h8mqb1bFjlA335344P78FqvJOWsm57YEI pjFd57rEfuqhvDyaiA+yxyXdtd0vuWxNrDFowxhIaL6aw9j6omhgTfOL+IIO1qGpmIad O7lfipM1V5fmKVAn0vLYhVTIz3dPvyf4SG39R7G81NkKwhdT+pcPFKfx0EOlne/N0mWV vxzmcbChMtaVq9VQhWL6nDpCVXH4t2td8dJC+WUs9R4rqh8Il+OenjVVWfWUBG7eRLSa 8j7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731551872; x=1732156672; 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=21xnoCfaPpesGzf+oyhhRlot/F+Lteg+nAvr3qsjeC8=; b=gxzkI2YQDLFqm+6xJOZRw+L5CNXxv/SMBEJfeSBqn9RYO41in3fDJrqze/rIdxnRWk j7f6qgh4duHs3RWp1c9ZEPyDOWjRFbflrHvurK7ztUTDRaL4Prbm0QIuT6L9l+JKm4yH 1Np6liWI9Dt4WYFNShM8CwieoQE15L6kVG8z06/Ulp1J4AGsx800piZPw84fCa4Z69lu z/DoT7yA5ZmnngIiZsChVepAI4sin09neQUdLuI3KxyOqcVuFT44I0cRUVVLds3XYEZk mmlxqnKtTmN5bBrJZ5/nrFazAi0LNG3He4RDsx3TNb48+sYvRutsD8yvGBhChLhjZMJ9 jlOQ== X-Gm-Message-State: AOJu0YzAVwH+8ukO4j3wN/f0H6yGEphPUPBVwkcJPmUN+a0dHK0izpP/ NCkX7Y4jsbaq6vdSaAhRihvX14GBIg3ggFN+9tUB1H6nxAsZrxxbJ1lHTxYGQ9mzbu4uBCTQb1j 4 X-Google-Smtp-Source: AGHT+IGWJRacdn65gtWiDmJsCMuLZsJbIkr+JCgezRQEv1Z7qsAxr6AoTK5SwOdSkrtbXvNGF4QMZQ== X-Received: by 2002:a05:6a00:4f86:b0:71e:cd0:cc99 with SMTP id d2e1a72fcca58-72469c48836mr695192b3a.4.1731551872278; Wed, 13 Nov 2024 18:37:52 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7246a5d2bb5sm150976b3a.29.2024.11.13.18.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 18:37:51 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org, Kai Ji , Ciara Power , Fan Zhang Subject: [PATCH v3 04/11] crypto/qat: fix size calculation for memset Date: Wed, 13 Nov 2024 18:35:53 -0800 Message-ID: <20241114023738.141821-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114023738.141821-1-stephen@networkplumber.org> References: <20241114011129.451243-1-stephen@networkplumber.org> <20241114023738.141821-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 2fce8fcb16..6f3eacaf43 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