From patchwork Sat May 3 20:21:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ethan Carter Edwards X-Patchwork-Id: 887249 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (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 28FAD17BED0; Sat, 3 May 2025 20:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746304120; cv=none; b=UAkewWWa8BE3VYXtMC8qfa3dyUe/xbqkVjduzDkNG2iTUD/fRTQTvNcWnUvt20N5WyWrByPB9SoKYubfdCZ9ShYJH81xmYqiWTT1cmWvOQ8K8GRiW8x/5NwG4+jFRERaFwCq23i2wOgHTln53U+wniOSokkuxlWav04BrAsw6T8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746304120; c=relaxed/simple; bh=9sXyHtfy2CGG1rNPSLIBNEw4neQ6gqlqo7AaRVn7gnM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rTTOdqk69dsFAh+dKVgaEOZ5PzAj4ywJq0HpvexQ3VgqkjnpUgpqg8lwMozdZbkpW3YFX4V4QVGZg23V5+Xw5mLEFv0tbxzKJTVHoZGenUvXQnKf+K8fXQm9BYVHEaVmXhXPkAZDlnsQSBmYllV9MwQXCu2BIpu0A1tthgfraqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com; spf=pass smtp.mailfrom=ethancedwards.com; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b=i+JJPNhi; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b="i+JJPNhi" Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4ZqfMM1F5Xz9sF1; Sat, 3 May 2025 22:21:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ethancedwards.com; s=MBO0001; t=1746303695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mhQibUgvi4UXWwBalaujNOuytv932n/6dTzw2/JyC1U=; b=i+JJPNhiEFMmRp/Soag9Mv1wTl44Gl2160CiGXDULMDJkAOr3BwU4FEBWFdShW0FxyH0+I PqxYSfxQqn5hncWCKOQDz2G6rlyZH3cx29cOabefZfxjxF7GBY9DEKyElCwtabHIFdaLMy aqhQh6wbuH59V9bFO88DhAtkAMbdD++a68btBCwrIeup7WgMjqZojvg1KYB5jK9ZJUa9Rd LmdObPEkX2wxr9fe+grNGf+9kEzthcbwlmTxtbNicQ7f9tbtYq2FByfyFskwlrov8aY3XC p4cvafyijX/rofLAm7Tn7VnS9Q2BM0EXOlvrcNo8TTijLWUnyp1ZIuriJUSoPg== From: Ethan Carter Edwards Date: Sat, 03 May 2025 16:21:27 -0400 Subject: [PATCH 1/2] crypto: hisilicon/qm - remove sizeof(char) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-hisilicon_qm-v1-1-d4ebc242bc8a@ethancedwards.com> References: <20250503-hisilicon_qm-v1-0-d4ebc242bc8a@ethancedwards.com> In-Reply-To: <20250503-hisilicon_qm-v1-0-d4ebc242bc8a@ethancedwards.com> To: Weili Qian , Zhou Wang , Herbert Xu , "David S. Miller" , "Gustavo A. R. Silva" Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Ethan Carter Edwards X-Developer-Signature: v=1; a=openpgp-sha256; l=775; i=ethan@ethancedwards.com; h=from:subject:message-id; bh=9sXyHtfy2CGG1rNPSLIBNEw4neQ6gqlqo7AaRVn7gnM=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgprQTBEQUFvVzJEM0ZOM09UeCtZQnl5WmlBR 2dXZXNlaDRQenZxM2pFQVExRDhxbXc3Z09QVW1EU3h3QmdEYmNSCkFvemV6ZC9UWW9oMUJBQVdD Z0FkRmlFRS8yd2padUVwbUNDNS9VU0MyRDNGTjNPVHgrWUZBbWdXZXNjQUNna1EKMkQzRk4zT1R 4K1pob2dFQXpyak5CTEFDbnc4Ui9kVTQwWVUrRElsZXVMbDIxU2RlMm5QZ3Z6Q0JSOTBBLzBlUA p5ZENSWXRTOWFQcjhkb0lZd3N2bzdWeXB5aFJ3ekZLZ1J6RnpTd2dICj1vS3hBCi0tLS0tRU5EI FBHUCBNRVNTQUdFLS0tLS0K X-Developer-Key: i=ethan@ethancedwards.com; a=openpgp; fpr=2E51F61839D1FA947A7300C234C04305D581DBFE X-Rspamd-Queue-Id: 4ZqfMM1F5Xz9sF1 `sizeof(char)` evaluates to 1. Remove the churn. Signed-off-by: Ethan Carter Edwards --- drivers/crypto/hisilicon/qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index d3f5d108b898bb5fa6ef901070e9e97b02afb29a..80d57f0dbf26e2902e01103b0a705234009161ee 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -862,7 +862,7 @@ int hisi_qm_set_algs(struct hisi_qm *qm, u64 alg_msk, const struct qm_dev_alg *d return -EINVAL; } - algs = devm_kzalloc(dev, QM_DEV_ALG_MAX_LEN * sizeof(char), GFP_KERNEL); + algs = devm_kzalloc(dev, QM_DEV_ALG_MAX_LEN, GFP_KERNEL); if (!algs) return -ENOMEM; From patchwork Sat May 3 20:21:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ethan Carter Edwards X-Patchwork-Id: 887039 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (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 A66DA27EC89; Sat, 3 May 2025 20:21:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746303709; cv=none; b=V2UekM922Ne4c1iXMaKlACyMDbqEBHNfoPhLosbUOMutgNGoAdeiY7y4j6Hkqjf56/Itye9r4z6YpIxgVAvqUENPUIcF9lrltGOKVhHTnAXR0kmoU+3EINgSYcmzYKbbL1VOX3xIjLW6qIJsYk0w/VC9CG8ndPLDFaUG0ZhuZyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746303709; c=relaxed/simple; bh=k4IQP1/of8aKcmJs9ZmrzxkHhlp//Mb+yyhXIBDdxrA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PrAB6CafgHCLFYHobh0zo0duzvunPjjswHnxzBtMMXQsjI7yicAPYVOuXqpsig3HTiu7kmC4Nv77zECGa6YzkcDmN59oDwpIoFUcEF9btLGiTTRDUZXKyIPGr1e4F/N+xdfCm+FWC2/YPNGBkDEtl8+ds77Bw9jBwnoJbbTPyUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com; spf=pass smtp.mailfrom=ethancedwards.com; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b=1whEk+Es; arc=none smtp.client-ip=80.241.56.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ethancedwards.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ethancedwards.com header.i=@ethancedwards.com header.b="1whEk+Es" Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4ZqfMP6sBDz9snW; Sat, 3 May 2025 22:21:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ethancedwards.com; s=MBO0001; t=1746303698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BP62rWp5Omj8xStj22ymmHAwI8JTM0+UjiVITZtvlr8=; b=1whEk+Es600K435koQp09RYo6oKFJrSEfnrmcqXAeYM7hK38dGZC44CS9MtIqFNHjotdgO 3uZhhFyy+RjiO/0fU/vzyyg/EuazsEmYgMpC3HrhIJkPEdHf8IKIV83ZMfu2QnEaNUEB0Q jg7qHTqhDS2fWDlchcx/zApoKcE4XNFPNYuEyDfP4TgFmPiuZbqwTJWLb50TKwU2e1UODc PdGeE0dMb7D1ttPTfBodoTjfASnLeakmg2kIjvlqtMK5UHR5V+nGTT6I5qzAoK0A0fJxgZ jGkPXOCn1OIY7ijA1Um8831L0Vv8esFO9eu0Rz56KQSbc/yHHxP/6Idzsj2jRg== From: Ethan Carter Edwards Date: Sat, 03 May 2025 16:21:28 -0400 Subject: [PATCH 2/2] crypto: hisilicon/qm - replace devm_kzalloc with devm_kcalloc Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-hisilicon_qm-v1-2-d4ebc242bc8a@ethancedwards.com> References: <20250503-hisilicon_qm-v1-0-d4ebc242bc8a@ethancedwards.com> In-Reply-To: <20250503-hisilicon_qm-v1-0-d4ebc242bc8a@ethancedwards.com> To: Weili Qian , Zhou Wang , Herbert Xu , "David S. Miller" , "Gustavo A. R. Silva" Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Ethan Carter Edwards X-Developer-Signature: v=1; a=openpgp-sha256; l=874; i=ethan@ethancedwards.com; h=from:subject:message-id; bh=k4IQP1/of8aKcmJs9ZmrzxkHhlp//Mb+yyhXIBDdxrA=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkp2QXk4ekFKWGJEOXFoNThlVGp6e GhQcXlVeFpJaFZIZjhjM0Nrd01XMFpyK2hscCtCN1Q5dDRyOFhkCjNXV1Z6eWIvYThtc2FVVXpU K3p0S0dWaEVPTmlrQlZUWlBtZm81ejJVSE9Hd3M2L0xrMHdjMWlaUUlZd2NIRUsKd0VSK0dEUDh zemtuTzN0aFVvemRlaTFWZzJzOUdWTTZWemRadUV4cXRKb3hUNXZWNG5yc0FrYUcyeXRVbGhVbw pKY3J1LzhDNjlIQzVjSEtmaS84SDFndGxaOTVWTC93N1liNC9Qd0E0MjB3dgo9cFpmVgotLS0tL UVORCBQR1AgTUVTU0FHRS0tLS0tCg== X-Developer-Key: i=ethan@ethancedwards.com; a=openpgp; fpr=2E51F61839D1FA947A7300C234C04305D581DBFE Replace devm_kzalloc that has an internal multiplication with devm_kcalloc to improve code readability and safety from overflows. Signed-off-by: Ethan Carter Edwards --- drivers/crypto/hisilicon/qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 80d57f0dbf26e2902e01103b0a705234009161ee..7c41f9593d039157ad900ee9fcc00e137d2ec169 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -5224,7 +5224,7 @@ static int qm_pre_store_caps(struct hisi_qm *qm) size_t i, size; size = ARRAY_SIZE(qm_cap_query_info); - qm_cap = devm_kzalloc(&pdev->dev, sizeof(*qm_cap) * size, GFP_KERNEL); + qm_cap = devm_kcalloc(&pdev->dev, sizeof(*qm_cap), size, GFP_KERNEL); if (!qm_cap) return -ENOMEM;