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 4E1DF45D07; Thu, 14 Nov 2024 19:45:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8BD9D42EF3; Thu, 14 Nov 2024 19:45:10 +0100 (CET) Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by mails.dpdk.org (Postfix) with ESMTP id 4D34342ED9 for ; Thu, 14 Nov 2024 19:45:06 +0100 (CET) Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2ea0f283a82so447950a91.1 for ; Thu, 14 Nov 2024 10:45:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731609905; x=1732214705; 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=43pErNCPd7BYohsBq9fO85hZf2oYBjcIorsJF+cTRyo=; b=PsA06gjOphhil7cowlfaImb6VoT5xHRhUJb0gavZ/5V3CuYFiUyXKlFF/EZFcK3MXG X7L3L/K780/p4OGP8Yb0waYJbXJ7WBtDbr29EM1J+/kMpEh0ikzWUfxHpWfz6b9VlZH7 o66MC01iDp+s7E88O5j5PHB28FAdOrrszm708GACQ4frIQuDlCTstJtTKE1uI2t93ATA kdlxeqe4Ipj2dzuRow73yQ9eCn0spYt8uiwrpTxisQ5erm23zo0RAMeuCm0cOd2qOpr0 HrSi1XF0TvBF2HRyGNvfQGooSDvuHRBlqoKwV0CS50xEB2Kjdsu1rX5yZ1MTbSrnmL6R XR2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731609905; x=1732214705; 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=43pErNCPd7BYohsBq9fO85hZf2oYBjcIorsJF+cTRyo=; b=OfJA5pAE0qDYI7fFLGtknPr/qAluqAjEHOKb8F1/Hzb1rmPTOb00BYnIJqAXe1ATbB +ZYZQTXNtmimOXLd4/sS2kQPPQxQVVKUALF2wKd2tflBz9nQorDJlCRBqZyPq4l37W8T RPOhBb+VyRrScIpp2trZ+0fZXN0twXohP6qUJ1eBuesdJDG3vrSkOWTqm20nfVXfmxff DekWfLbRmzQSy0aoLyVSElyWiGxceTF41mWxCe/5dMjZzoaboO5MegYKd0dyO4xD5jFE XZTnyj95g2sI/4BtLPjGLtE2b0Ap07yXiN90LXevqgGs7M6gdX9hvSsHJyBOK5dEJ2Q/ 43XQ== X-Gm-Message-State: AOJu0Yxna6eHtuK9CWn+V/r4R27ByI2k1xGbXerq3mdfhYztlDv0DEQ0 sc/ark6zdj3uEtIW1G9L029/UfzmTOuNGEhDi2Z5JyRXsXvNj8UXJOaWJ14HcAl0vF83dKBYOkC xEak= X-Google-Smtp-Source: AGHT+IGj1cHri1p1mZQfOY/9zU/2CDTa2dNqCAiNLJYJzKxXwlmSbZXiZiK+IqHrLj90KaDcBRoB3w== X-Received: by 2002:a17:90b:314a:b0:2e2:c406:ec8d with SMTP id 98e67ed59e1d1-2e9b17962a1mr32863870a91.31.1731609905449; Thu, 14 Nov 2024 10:45:05 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea06ef71a6sm1517611a91.8.2024.11.14.10.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 10:45:05 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org, Bruce Richardson , Kai Ji , Fan Zhang , Ciara Power Subject: [PATCH v4 04/12] crypto/qat: fix size calculation for memset Date: Thu, 14 Nov 2024 10:43:26 -0800 Message-ID: <20241114184452.31854-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114184452.31854-1-stephen@networkplumber.org> References: <20241114011129.451243-1-stephen@networkplumber.org> <20241114184452.31854-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 Acked-by: Bruce Richardson --- 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