Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4382606rdb; Thu, 28 Dec 2023 22:45:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeSB9Vt5lebtoWI7aH66G68BYf78oPSLIV89csvw8xc3crkJj6TcwbWJZanCk8Y7EzovKZ X-Received: by 2002:a17:902:f782:b0:1d3:7348:88f5 with SMTP id q2-20020a170902f78200b001d3734888f5mr10927314pln.95.1703832352139; Thu, 28 Dec 2023 22:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703832352; cv=none; d=google.com; s=arc-20160816; b=B8ceiLF8Gp1qH4aFu5dFa5IpOQE92BO71380et/LmTdN0OMgB+ORu6hEA5pgR5F9nP iYDOWJpZ9LBE143Fr3l4pupe+1+/c7zvxY8nBuTW/ipUyvBjyHRpag57nmf0PDqQriyz OSLPBAq/5mbagrCWE3YcqO2vOSW6S8zBm4iEcpR5L0sDE0QIWh7w64K2/4uIpS/Qvu5Z T2vz2D49Pj7oSNE5FmV/2//wp8rnx9K54dNLd0EAlA4T38Gpz5fMPuof2JhNg8P0NhyL pahQ+wdxzIVhQqYeYXBl48L/2Th+3MuT9sF69tWhuI4C8kutJKL9gBgYNTD3RNVmmlYS UZ0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=toTRq4ugyx7SplxWU9t9FpewIUUF4AmSEX6ZhMF0StA=; fh=wxe9XR9VLnk0wQjyl0lDu7hTfgxy++r9V/gF2e7GfkU=; b=ru4YwN5PEDFVqQfoF03N+ci45FOf31CG/oiAnh/slqlPtx0dssWT3eXZnlNrWrMgpg XOJN/UrUYB9bilByThiRKIauWkr0oqauCtVP8JV6DnGcK54CClKEtFCM7zPXxNOf+Qi8 eo9hEu4VRN0SQxsDmvbZ0G3Yet23y4kzsLPgRD3hOOxJ0AQBKnwACKAL3w6oY4YD0+6z NoKkEV0Nj14CXKtd+3dDlIa/2jdGcwQaX1qS6VCXVJiJ3xfZ/LHNRPJQDhA5I6pU0GUA euSa1sXOMavqOOrfIQ8tk29Vhffi8vBCIkd+Y+P97O4CgEekIUhqrkP7zl6RGR40+wtM Y5ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id im22-20020a170902bb1600b001d2f6d7f080si13782094plb.12.2023.12.28.22.45.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 22:45:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CD7DB2828E8 for ; Fri, 29 Dec 2023 06:45:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55C741C2B; Fri, 29 Dec 2023 06:45:17 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 E94A723A1; Fri, 29 Dec 2023 06:45:14 +0000 (UTC) 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 Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4T1bTR0FLtz1wpkX; Fri, 29 Dec 2023 14:44:43 +0800 (CST) Received: from dggpeml500001.china.huawei.com (unknown [7.185.36.227]) by mail.maildlp.com (Postfix) with ESMTPS id 314891A0192; Fri, 29 Dec 2023 14:44:52 +0800 (CST) Received: from huawei.com (10.69.192.56) by dggpeml500001.china.huawei.com (7.185.36.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 29 Dec 2023 14:44:51 +0800 From: Qi Tao To: , , CC: , Subject: [PATCH 3/4] crypto: hisilicon/sec2 - fix some cleanup issues Date: Fri, 29 Dec 2023 14:44:20 +0800 Message-ID: <20231229064421.16981-4-taoqi10@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231229064421.16981-1-taoqi10@huawei.com> References: <20231229064421.16981-1-taoqi10@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: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500001.china.huawei.com (7.185.36.227) This patch fixes following cleanup issues: - The return value of the function is inconsistent with the actual return type. - After the pointer type is directly converted to the '__le64' type, the program may crash or produce unexpected results. Signed-off-by: Qi Tao --- drivers/crypto/hisilicon/sec2/sec_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c index 692ba3213cc6..5d4facf62c86 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -118,7 +118,7 @@ struct sec_aead { }; /* Get an en/de-cipher queue cyclically to balance load over queues of TFM */ -static inline int sec_alloc_queue_id(struct sec_ctx *ctx, struct sec_req *req) +static inline u32 sec_alloc_queue_id(struct sec_ctx *ctx, struct sec_req *req) { if (req->c_req.encrypt) return (u32)atomic_inc_return(&ctx->enc_qcyclic) % @@ -1371,7 +1371,7 @@ static int sec_skcipher_bd_fill_v3(struct sec_ctx *ctx, struct sec_req *req) sec_sqe3->bd_param = cpu_to_le32(bd_param); sec_sqe3->c_len_ivin |= cpu_to_le32(c_req->c_len); - sec_sqe3->tag = cpu_to_le64(req); + sec_sqe3->tag = cpu_to_le64((unsigned long)(uintptr_t)req); return 0; } -- 2.33.0