Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp123328rdb; Wed, 21 Feb 2024 20:27:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXLcqo7v0fUiasO7xvVzd02Qe42nbfRtrWsxSkrehtPBB3Q4fPLmWMPltUG44wR1wD5p1S1DQSe+bzKqkzITRB1UttYjTyksVjBeqvUbQ== X-Google-Smtp-Source: AGHT+IFmI6t9n6kTAVmqNi0hLGUUpcDCsjLYJNcPAhaq26DKRjTxndGQgHelnrGu0TK5uprLS/9q X-Received: by 2002:a17:906:b30b:b0:a3f:1c10:5a63 with SMTP id n11-20020a170906b30b00b00a3f1c105a63mr4091513ejz.38.1708576064116; Wed, 21 Feb 2024 20:27:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708576064; cv=pass; d=google.com; s=arc-20160816; b=c7bK0zQe1J7lvrkxjy2jE/azHux7U4j0vSuApD8rVKtdjiHzcmObmNPo2kG8akFt6E 6p0GQpedwxgkhMtUiYS7mLLIl8WqFf8pym15V9XxPMbFSLP49AiswV4hbbIxia9gX4hi V0BFu89kKqlXI1QPgdZHl+U8KcSjP3QKjs1LbesRs+fM10n27S5HwMsZXCVuTRNTmTyN I9smZSFht+FBvukqGDZWSSrrE0zAQzotvGnyVKI7FuGvSILhMUgyyPC7Am5y979ip+4y yhHXKAImbz9usl46pj40YXhsSJBWLu3RCHP1YZMYrQTbBFUS0oB7CG1PqGr9Vt7ejPwX 6khw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:date:to:cc:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:dkim-signature; bh=oFSGpvFms3hEQid0nl1slnjolsRI31AFhOlPP3m17wA=; fh=ykHtFHuviy2oMRJqT7fmkZxXJ6PmnGBhVOsU5mGZlxY=; b=WyKsq5Yx6DFpYkH0ofdyTmlfDlMZAOnZmVn1fstzargQbHoXS1LgZ9jBRY6id746/Y L4j183BmpjbM9qE8ou2EFv8pldyVWo7J/YZqpujnd95ZhryHX21waPyPdLYdLPJK8h+A tFYLvZySG3n6tF03uOHHyykpt4gMMYEfg4UXzgdhBSNs69xk21A3HB8tH+3q1SKtab4z 1MGaXnjVSWg9e3Z1Z1zVxyTVjkv3H0JVABERyZDjkVOpHXpuF0v1S9TYp1WtEBsYhbkf 3m3K7fXJhvqOr5I6bwFHM6wBGDunH5yt7R+9LRceQebCRgz0UNffMW9gKnRiHSfgaibM 8N1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=degz5bbf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hp26-20020a1709073e1a00b00a3f8e0f9845si76711ejc.237.2024.02.21.20.27.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 20:27:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=degz5bbf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C73D91F238A3 for ; Thu, 22 Feb 2024 04:27:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D167F179A1; Thu, 22 Feb 2024 04:27:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="degz5bbf" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EDD911775B; Thu, 22 Feb 2024 04:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708576055; cv=none; b=dAmWzxPjJXcEkqk8EMEa2F5D+Yv64XRqL9uxibdoA0eF5pbvbxF9bgI5Tbq/MgObje/BeZxnAG0e6UzCFj7Or70foRXYMLg1by4ZD0z/jGqOYZ0Fyx9DGQ0nhFTdY//vibRptvf+YJQPt7AKZU7WSil6nDpjlm1KKZOpaEgPZaQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708576055; c=relaxed/simple; bh=oFSGpvFms3hEQid0nl1slnjolsRI31AFhOlPP3m17wA=; h=Message-ID:Content-Type:MIME-Version:In-Reply-To:References: Subject:From:Cc:To:Date; b=HGWvfBferquwfSN8yHc0ZnX8CU82xEljaSHTU6RThPINtpQrg/wUQ/03JgvVZNMVT9wur1fReBURl0eGZR0Q1SzD4piqbbQd9D63rSkh4rfHhPhzCIQOdBd9R6wqQYQ288c88VjhyWc58D7N5FamJkERGUwkD/uFD6EB69D3dXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=degz5bbf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A34DBC433F1; Thu, 22 Feb 2024 04:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708576054; bh=oFSGpvFms3hEQid0nl1slnjolsRI31AFhOlPP3m17wA=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=degz5bbfCmTaX8+5xbK3rWriaahvDIWKfVNKagSXqfrDwnJYzezNaMrFgFKzQVhPO OXlyXwpvl5c2miPkr3w9BXgN/by/UynCS9BaSNGeO2fC6O18AAYU8SsqSLGdcqlao0 SMabx0q4vSAu82azyCa1AOq5qfnqbej1qBz7pz7ji1T3RRZTmi5kuBUHBs0DTDrGh/ 0GX8E9pPELXyU1acG/xtKhEQ4hkTOjzk66sY9Eq/P1wrfKavrZYFUhcebc3kw0whiA 2iYk4dvQkZ51w3wGKLWecb3as1adaWETmS/n6aHcObe+1VaTW4lYCQH0JHzo53/J+3 EwMiMFyKbEAgQ== Message-ID: <61113ffd54a32399ebdc31fc1a57912f.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" 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 In-Reply-To: <20240121142946.2796-1-erick.archer@gmx.com> References: <20240121142946.2796-1-erick.archer@gmx.com> Subject: Re: [PATCH] clk: hisilicon: Use devm_kcalloc() instead of devm_kzalloc() From: Stephen Boyd Cc: Erick Archer , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org To: Conor Dooley , Dinh Nguyen , Erick Archer , Gustavo A. R. Silva , Heiko Stuebner , Michael Turquette , Nick Alcock , Rob Herring , Uwe =?utf-8?q?Kleine-K=C3=B6nig?= Date: Wed, 21 Feb 2024 20:27:32 -0800 User-Agent: alot/0.10 Quoting Erick Archer (2024-01-21 06:29:46) > As noted in the "Deprecated Interfaces, Language Features, Attributes, > and Conventions" documentation [1], size calculations (especially > multiplication) should not be performed in memory allocator (or similar) > function arguments due to the risk of them overflowing. This could lead > to values wrapping around and a smaller allocation being made than the > caller was expecting. Using those allocations could lead to linear > overflows of heap memory and other misbehaviors. >=20 > So, use the purpose specific devm_kcalloc() function instead of the > argument size * count in the devm_kzalloc() function. >=20 > Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-c= oded-arithmetic-in-allocator-arguments [1] > Link: https://github.com/KSPP/linux/issues/162 > Signed-off-by: Erick Archer > --- Applied to clk-next