From nobody Sat Jul 25 04:30:38 2026 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 076A22853E9; Sat, 18 Jul 2026 03:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784343927; cv=none; b=bFpjcjYbI3qsny0nmUi0sRZ/ju8dJlQJvNRHzo+icu7tBpVLL3FxsQx5biU2XwwRSFQ5c2k0lbL6GPL6ShV9WMzrmHN/GpcqAwx/4300Cd/8ZFbcM2WT26bpmQtCXT/mDbyN+XsuUVWcq7p54WSZ2Huwwc37YJeKzlC/aOHqE7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784343927; c=relaxed/simple; bh=4mm9C43Y9salZwV/Qk7LpmRUV9yRXIajgAj0tiI6OuE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ioC+YLVmgH+4VlrYufrAaxhuKNPVMI5s71oLIVokMwO0ihTZakvp8TfxNf9cJPUvlDzArc48kSSJ0hzWv9bxn6bvHgzeD19e/x1eJIBj/mechguVip3e+MCSchFwjTbGWZmHWkqFxOQZt0HsmC/I3MIVnn8lnINUkoTv+kyjVa8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=O26B+/YZ; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="O26B+/YZ" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=XAxSGU3hFKXfpEqzTBfJA8k8iuWxoxqPnUaq53YyEXA=; b=O26B+/YZKKvd7Y1ruemOLZuknaY+pmvTksUkIgoSU8xVbCeEzRD0iWW2NbnhwMe5txsBoGzeU cuMjXts3pfdBPHs333WSiTbBCRAw1Nk+PUC6DnLeqKpWBjcyDLj5EmlTinCA6o117XhQRj1D5I+ Ny0u5A8I+l/rGNZZuaGg9r8= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4h2BHG2VJrzcb3P; Sat, 18 Jul 2026 10:55:54 +0800 (CST) Received: from dggemv706-chm.china.huawei.com (unknown [10.3.19.33]) by mail.maildlp.com (Postfix) with ESMTPS id 5808F203B8; Sat, 18 Jul 2026 11:05:15 +0800 (CST) Received: from kwepemq200001.china.huawei.com (7.202.195.16) by dggemv706-chm.china.huawei.com (10.3.19.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 18 Jul 2026 11:05:15 +0800 Received: from localhost.localdomain (10.50.163.32) by kwepemq200001.china.huawei.com (7.202.195.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 18 Jul 2026 11:05:14 +0800 From: Chenghai Huang To: , CC: , , , , Subject: [PATCH 1/2] crypto: hisilicon/sec2 - fix uninitialized type_supported in sec_create_qp_ctx Date: Sat, 18 Jul 2026 11:05:12 +0800 Message-ID: <20260718030513.3809002-2-huangchenghai2@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260718030513.3809002-1-huangchenghai2@huawei.com> References: <20260718030513.3809002-1-huangchenghai2@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemq200001.china.huawei.com (7.202.195.16) Content-Type: text/plain; charset="utf-8" sec_create_qp_ctx() reads ctx->type_supported to pick its callback, but sec_skcipher_init() and sec_aead_init() set it after sec_ctx_base_init() has already walked the qp_ctx loop, so the value is uninitialized when first consumed. Set type_supported in sec_ctx_base_init() before the loop; the alg init paths now just select req_op from it. Signed-off-by: Chenghai Huang --- drivers/crypto/hisilicon/sec2/sec_crypto.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hi= silicon/sec2/sec_crypto.c index 77e0e03cbcab..5c2b9f710be0 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -672,6 +672,11 @@ static int sec_ctx_base_init(struct sec_ctx *ctx) ctx->hlf_q_num =3D sec->ctx_q_num >> 1; =20 ctx->pbuf_supported =3D ctx->sec->iommu_used; + if (sec->qm.ver < QM_HW_V3) + ctx->type_supported =3D SEC_BD_TYPE2; + else + ctx->type_supported =3D SEC_BD_TYPE3; + ctx->qp_ctx =3D kzalloc_objs(struct sec_qp_ctx, sec->ctx_q_num); if (!ctx->qp_ctx) { ret =3D -ENOMEM; @@ -2067,13 +2072,10 @@ static int sec_skcipher_ctx_init(struct crypto_skci= pher *tfm) if (!ctx->qps) return 0; =20 - if (ctx->sec->qm.ver < QM_HW_V3) { - ctx->type_supported =3D SEC_BD_TYPE2; - ctx->req_op =3D &sec_skcipher_req_ops; - } else { - ctx->type_supported =3D SEC_BD_TYPE3; + if (ctx->type_supported =3D=3D SEC_BD_TYPE3) ctx->req_op =3D &sec_skcipher_req_ops_v3; - } + else + ctx->req_op =3D &sec_skcipher_req_ops; =20 return 0; } @@ -2100,13 +2102,11 @@ static int sec_aead_init(struct crypto_aead *tfm) ret =3D sec_ctx_base_init(ctx); if (ret) return ret; - if (ctx->sec->qm.ver < QM_HW_V3) { - ctx->type_supported =3D SEC_BD_TYPE2; - ctx->req_op =3D &sec_aead_req_ops; - } else { - ctx->type_supported =3D SEC_BD_TYPE3; + + if (ctx->type_supported =3D=3D SEC_BD_TYPE3) ctx->req_op =3D &sec_aead_req_ops_v3; - } + else + ctx->req_op =3D &sec_aead_req_ops; =20 ret =3D sec_auth_init(ctx); if (ret) --=20 2.43.0 From nobody Sat Jul 25 04:30:38 2026 Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A796298CB2; Sat, 18 Jul 2026 03:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784343928; cv=none; b=e/+sPoK0rgEo2N7feVxcp5y2UwoAs9mv8lJFvXI+Ydm7ZTm7edIAHUWbFtFUU5o5epYvk3zu1nTVUW9OW4KpdC6R1Sxp+C/LUvf5DxZGBT0op74mGWDm9klJXNOwg75GlqhUXuTGPfWkwSVhhhVmfx073YuDz0NzWL5VtI+ZMOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784343928; c=relaxed/simple; bh=6ArKrhRDDezNd9VJBlOb9lsXXbapJuyed07oHb7ITXs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lryl6KnbjLZcpJ4VZvpsyvDlOuLAxrSmxrQ41GI6tJ4DYZsHRpUYvKXuIxcgJcrt3HhF5kOvHAJc4tFAvIR3zHKHUKUJRoaNSY/jGmpOGl801Ge0mNiAv+TPVmdL25O2uKfaQZ9q83pR/gU0S0cVm0V1ol//U34Q4AJDdR0Xa2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=EHF8GAFE; arc=none smtp.client-ip=113.46.200.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="EHF8GAFE" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=emvvsj9fAag+teAYRsRI4fFCqIQmEElCOT1npoSd+TM=; b=EHF8GAFEdKLE0ZRFLYHRTYh5TAJ9cry1hI+PFXOi3YcvD9Fyq4QWGdjINI7MfFwoIR2z3+kYJ qEeXAcznerPWag0biMqZUrlzuAlBnBarzAugRs3TArJiLmIETYKb3Qm1jFfgh6FTQvwO/ob1ZHj zhOid/hMsnlpw0OOw382Qzs= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4h2BHk36LfzpStj; Sat, 18 Jul 2026 10:56:18 +0800 (CST) Received: from dggemv712-chm.china.huawei.com (unknown [10.1.198.32]) by mail.maildlp.com (Postfix) with ESMTPS id D69F44056E; Sat, 18 Jul 2026 11:05:15 +0800 (CST) Received: from kwepemq200001.china.huawei.com (7.202.195.16) by dggemv712-chm.china.huawei.com (10.1.198.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 18 Jul 2026 11:05:15 +0800 Received: from localhost.localdomain (10.50.163.32) by kwepemq200001.china.huawei.com (7.202.195.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 18 Jul 2026 11:05:15 +0800 From: Chenghai Huang To: , CC: , , , , Subject: [PATCH 2/2] crypto: hisilicon/sec2 - remove unused sec_ctx.hlf_q_num Date: Sat, 18 Jul 2026 11:05:13 +0800 Message-ID: <20260718030513.3809002-3-huangchenghai2@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260718030513.3809002-1-huangchenghai2@huawei.com> References: <20260718030513.3809002-1-huangchenghai2@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemq200001.china.huawei.com (7.202.195.16) Content-Type: text/plain; charset="utf-8" hlf_q_num is set but never read; drop the field and its assignment. Signed-off-by: Chenghai Huang --- drivers/crypto/hisilicon/sec2/sec.h | 3 --- drivers/crypto/hisilicon/sec2/sec_crypto.c | 1 - 2 files changed, 4 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec.h b/drivers/crypto/hisilicon= /sec2/sec.h index adf95795dffe..c12a39a8a9d4 100644 --- a/drivers/crypto/hisilicon/sec2/sec.h +++ b/drivers/crypto/hisilicon/sec2/sec.h @@ -181,9 +181,6 @@ struct sec_ctx { const struct sec_req_op *req_op; struct hisi_qp **qps; =20 - /* Half queues for encipher, and half for decipher */ - u32 hlf_q_num; - /* Current cyclic index to select a queue for encipher */ atomic_t enc_qcyclic; =20 diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hi= silicon/sec2/sec_crypto.c index 5c2b9f710be0..01eb76f616fc 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -669,7 +669,6 @@ static int sec_ctx_base_init(struct sec_ctx *ctx) sec =3D container_of(ctx->qps[0]->qm, struct sec_dev, qm); ctx->sec =3D sec; ctx->dev =3D &sec->qm.pdev->dev; - ctx->hlf_q_num =3D sec->ctx_q_num >> 1; =20 ctx->pbuf_supported =3D ctx->sec->iommu_used; if (sec->qm.ver < QM_HW_V3) --=20 2.43.0