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 3C3AB45CFC for ; Thu, 14 Nov 2024 03:37:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E881427E9; Thu, 14 Nov 2024 03:37:58 +0100 (CET) Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by mails.dpdk.org (Postfix) with ESMTP id 2BCB0427B7 for ; Thu, 14 Nov 2024 03:37:53 +0100 (CET) Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-72061bfec2dso39077b3a.2 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=YWysm0vz76CYcsT+cHLyUKC8kIY2YS+zGU0atn25Jvtb78BwBJnu8AWWQ4UVMCoDlM q+2vJ7HGVu1Z3ZtOVEOXBwbI9RzMJ+97/zht3lzsAj79jsUGYmFHA+tP2IHg9OQ82Jdj /en0Ytyp9XkybZ1Z3D3dLd+ufFd2gUBcWcQnPMcd7F4l7cu8Icm2x1rmxEm+dzxWO1bz ho0QXUxvKJYdR8AYY4kxpfa1dgrW7beFZXDPrfoTFbAmMR/qIvIMnP/p9LiSCWH7ZOIg UpD4z+134sUuTtVCnOqpOghBUt+23gLL/aRV6hWcGTIYIeDQltzxYUxtzNY9xyC04UQj hR8A== X-Forwarded-Encrypted: i=1; AJvYcCXQl2GzCIwGQ99PyapCPjRzwnMKVaQNVKRhNXPmbWVmXVBHJ+vHU2B27O31K2Ay3lKe7SkHlEA=@dpdk.org X-Gm-Message-State: AOJu0YxexlGTkiwqgtYczO58rsWRu3hjMort2BDpcDAbePZXX89xf2n2 LhIQl0Cwrl9ulapb7Sz+/4OI6ixOlKkgdAvqxxCtUjp4tUnsWk6qTPGAt18pAo4= 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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