Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3100970rdh; Thu, 28 Sep 2023 02:36:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWKlJBbcjmeAC2Xx+LUg260IDqBXW6YggoCNZmryX9bcYOXK6vL5bIYi/l0Hz+EMp3opQo X-Received: by 2002:a17:902:c409:b0:1c1:e818:1e76 with SMTP id k9-20020a170902c40900b001c1e8181e76mr1179313plk.6.1695893807980; Thu, 28 Sep 2023 02:36:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695893807; cv=none; d=google.com; s=arc-20160816; b=Dv05jMr0YxhvOfwzugrz7ygYDBU1IL4s14PqyiQ9m+6j6nAonGyiJSMC+NIM8uSffK Bpk/15Mxh6P/gf/54mpjK/vsTGdcSui6oLABeUU8oqNJXkBfM47H8fEwbfaejpO5LBu7 OVITENQjNJpojEvJ3k8hTFqSCx2y/oNyxB4bG3Dg3CXJkv7WbQA9IBjWqXUTd/ubi7ox sIRq5PcNy+etY2Dkvrmzwy9HRN8TCuR8V3UT9a8YO7odqRiZ/Xp6cvJQRE9F4TJwJsbS B7H14BFnDTGrHLZkLC4nLYCLLf3A+lZvKbbDb2X4wJwthcOgY4CFY7zCEmnDlFNqRS5N cimA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=egMeSDnLr8bMtSmKYS32ba5khobc6NjQGREMEJHCmUs=; fh=NUAlJo3HXSCQJJ3D0jNblauZVXsBmhXHFqwj3slIsi4=; b=DMXuxD9br6bZXguvpYUBXJRGzEJBsMVsonSQp2lLG/pzMyqrVMtCpWA0MoU2T97YXY vx/Udyv5Sln5VpthwHscqTvyVhjSKTVqObzkKz6SVgAFz/rsWk0dreSQdn1TNOnDI1ln PyVT0sH3Ni6xAvk+lw1KdiOivz5xgvqowXMOTDzf2HiAQl+141Wit0wU+tBr+6uMk9E9 UN5OIHnAwmooGjeKkaRq6AzRDUsV69zZ6Xcwp6Mwu5pBydqk93d1bmjobqSzGosDmdKJ YgGVYVfyQ3444Dv8rfY02n4yAuhPOibfzewY88ariBUF2OLOb0DtXSATaAfU3Ed2xeA3 iVTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id n2-20020a170902d2c200b001b9eb349549si15373411plc.630.2023.09.28.02.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 02:36:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 02C2982606C8; Thu, 28 Sep 2023 02:24:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231577AbjI1JYg (ORCPT + 99 others); Thu, 28 Sep 2023 05:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231550AbjI1JYe (ORCPT ); Thu, 28 Sep 2023 05:24:34 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45CDFAC; Thu, 28 Sep 2023 02:24:32 -0700 (PDT) Received: from kwepemm000009.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rx7Hq3DJrzNnyN; Thu, 28 Sep 2023 17:20:39 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000009.china.huawei.com (7.193.23.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 28 Sep 2023 17:24:29 +0800 From: Weili Qian To: CC: , , , Weili Qian Subject: [PATCH] crypto: hisilicon/qm - fix the type value of aeq Date: Thu, 28 Sep 2023 17:21:03 +0800 Message-ID: <20230928092103.49587-1-qianweili@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000009.china.huawei.com (7.193.23.227) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 28 Sep 2023 02:24:43 -0700 (PDT) The type of aeq has only 4bits in dw0 17 to 20bits, but 15bits(17 to 31bits) are read in function qm_aeq_thread(). The remaining 11bits(21 to 31bits) are reserved for aeq, but may not be 0. To avoid getting incorrect value of type, other bits are cleared. Signed-off-by: Weili Qian --- drivers/crypto/hisilicon/qm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 1638c0a7df31..458d1fe42a24 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -69,6 +69,7 @@ #define QM_AEQE_PHASE(aeqe) ((le32_to_cpu((aeqe)->dw0) >> 16) & 0x1) #define QM_AEQE_TYPE_SHIFT 17 +#define QM_AEQE_TYPE_MASK 0xf #define QM_AEQE_CQN_MASK GENMASK(15, 0) #define QM_CQ_OVERFLOW 0 #define QM_EQ_OVERFLOW 1 @@ -1024,7 +1025,8 @@ static irqreturn_t qm_aeq_thread(int irq, void *data) u32 type, qp_id; while (QM_AEQE_PHASE(aeqe) == qm->status.aeqc_phase) { - type = le32_to_cpu(aeqe->dw0) >> QM_AEQE_TYPE_SHIFT; + type = (le32_to_cpu(aeqe->dw0) >> QM_AEQE_TYPE_SHIFT) & + QM_AEQE_TYPE_MASK; qp_id = le32_to_cpu(aeqe->dw0) & QM_AEQE_CQN_MASK; switch (type) { -- 2.33.0