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 A37BE45CFC for ; Thu, 14 Nov 2024 02:54:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA75D427CF; Thu, 14 Nov 2024 02:54:24 +0100 (CET) Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by mails.dpdk.org (Postfix) with ESMTP id EAB89427AE for ; Thu, 14 Nov 2024 02:54:19 +0100 (CET) Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7f8b37edeb7so981a12.0 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=mhyOLp3vrh/g1/unWBsl+I/YkXgiBJM1ZHah4HTVhxOeuAli/kxYEzYKqxkj41i5qa G2zqE8FuSI6um6zuJ6XnadUzVs4Ax4oPPbExYFRFXao1j5kmLmtu6G9fdr7HKJBPEk10 F1dbQJ7gU03gsPOmVEKL2GOanJxc9Qsj2yqQz59O1k5zys38zymLD3H7YJY2dd/S1nGR uDQ3+bGwcPazfHNKUwHn4ReD5P+JRRga5qHirNu0R2TNM5CedJ0DzXeaTSRzwuyODPFk YBlChe1+t6skeANplHX/gj3n/usR9j7tFY5ID/DFXZtHepFImi5LTCYQoAefXZYtC2Ho xrLA== X-Forwarded-Encrypted: i=1; AJvYcCU2yMhSCEHmSdrUnQtlOd44O97prgRiRdAu6FIsiDS76mwjywkmwCgW44t0HcvTGSrh+mFyQtM=@dpdk.org X-Gm-Message-State: AOJu0YyweMVSAb6cwIXOCwIOA3KQmiEZeYc/Y//cFlNpCoZZbTopFyyb 7vzKIh0ohMznhMjNr5tuA7d6zu+315PUX9Z4TRs5iygNoQLFJlRymd9q6WVXaco= 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: 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 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