From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1ABC42069 for ; Tue, 24 Dec 2024 04:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735013994; cv=none; b=tW7qtKPThHPgQLTBMoRSqXMhn1uHQ1OOi9z2Nt8JzPl7Nta2sfnW/OXd/ORganKs6P35+cgqE6IbT+k1ymkXR5aWkS5Tb2+m1QibaiVuYxZVMKOo/RBbkG+JyzhXMiZ8NFqdRm18bCWzf6f0nhaZAXmkHtB3ULxHQIiH/dDTd1U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735013994; c=relaxed/simple; bh=/quy8tTr2h42T3RwdmQuWgwqykGwFTSxMQBBGKlyrWQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J8qSWrF6CgZ9tRDUP0fnseWMl2A2vpUJnoUxVKQT+zeN1w9OuFDeH+8wVp6Kh4HhGIbloAvwiXnwr1yuG8SP7g6Esg393TQsSQRtua3Qzk5wmsHtvD9mVrmabTXMUJI8Wk5C6bq+i50w5K5oMHGNML9tThSA75dNAW1Y8n7Bd7E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ztU8famT; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ztU8famT" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2167141dfa1so45211645ad.1 for ; Mon, 23 Dec 2024 20:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735013992; x=1735618792; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jOI9pQuxkF5ADCxpeB0oRXSyPI8jyNgvjWCCXMA1spI=; b=ztU8famTlTsklTKI9bhEjiW2zjwr97G8uXS4Bm2SLBX6cYJmOeKmsLhuxyqUdOwKQn OQvE4J6wKRaqivykQ13LcCav0qnAro+NbLsxjG8wJzdX8XuOBphlDjm25IXM5btHHVuG o5/K5YoTTpvJzYlwKMNwhFhg5SddJLGTzmQk0VemZeFTrIL0VZGcGyjG6T4cGYsvHyCJ ZnezbahE9LcKKGqXS2s9jZWU5FSLDHo35LtzS86TKPdwuq8Qd9BvatnEWOIAKLXR49pg oE3J3q6zmtYfwIa/qi+1+g+ET1U6pJB+DisPoPnrBX6qGw55BZ0X2CAUUcxIwNu/U0Zk jHJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735013992; x=1735618792; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jOI9pQuxkF5ADCxpeB0oRXSyPI8jyNgvjWCCXMA1spI=; b=Ku/aap9rqIHqN7RsyBXHik2cSgWjvUaHu2H+8E0IRTc5DifzZrQGcx9ylw+iKQCNxY gl6QLM5EK4GbxqS2Yh9DLg/OHTA3tF4sNRbnt0Sum5zSG56VMTRe9TYpOeVA3WUrPD0l PVsg3LPwm//G9qMZOt9jKgqBcdZzGTHzseUUG8YracYzdnvShsLLlliPEzAYzEZwirY5 7cchwgx3lgG6s3VIA7vJTDhnBYpmhhuzY6ZP6NLa7xW0s9FI98KbNX+o+hXNSNNE4B0K B16U8GeJTWJvOxgfEcyqNerDirvJqtzN9cSjrqhEiryp17Uw8PNvVkGFTUvynMr7gAbq kUnA== X-Forwarded-Encrypted: i=1; AJvYcCUUOGrvYSHc+aej5+Do4DY6QKZsREm34cfpLjrS7u8DuLyv9NUhQMgHvxdOAzU8LTSaR0fpzNAlfe2zI0k=@vger.kernel.org X-Gm-Message-State: AOJu0YwBUANK2L8hJ06Gnitpy5+149MyFSiG45oqdGah5SytdyfXvweK rKjfy9w8Bf7/xS/v2rpjeG/FgoYTEDDuilX25l7KAiiUbve5UEvomkSq2RcbqRY= X-Gm-Gg: ASbGncvmb0Q3dk1fuHNHzJDXWrv/G9/TST5AIhmo+l+33KaqufLgCJuGPJW6ZIGJrqu eqwdyZHCRZgfuUq2+2GeV0xVTv1PAE0opLnzer3A3UJek/rvfNf+DBnCd5SAcAp2hysMJMAv9lB ljy1efgfqhWCUFd4mYJQhHM4BV671FRNOsRrGSiIgEHKIB55KXnRTaPcfvjd4merUkBOYeWtek3 HxKQYfQn1YuQX6WRQAVlaxVKNp/MMfHTWCWqLQ3gkWZ2+4yjAEdU+iWEXM= X-Google-Smtp-Source: AGHT+IF/A54go9F4QTm02Cgzh0BpPrFD77aKAPA/1tGBhsVFnFJs6RELYVBExn0EXuJAO7qMB5zf7Q== X-Received: by 2002:a17:902:da8a:b0:216:11cf:790 with SMTP id d9443c01a7336-219da5f0a54mr282804935ad.16.1735013992173; Mon, 23 Dec 2024 20:19:52 -0800 (PST) Received: from localhost ([122.172.84.139]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f72b8sm81176685ad.191.2024.12.23.20.19.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 20:19:51 -0800 (PST) Date: Tue, 24 Dec 2024 09:49:49 +0530 From: Viresh Kumar To: Ethan Carter Edwards Cc: "rafael@kernel.org" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] cpufreq: sparc: change kzalloc to kcalloc Message-ID: <20241224041949.ewmo3f5beyuoilsv@vireshk-i7> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On 23-12-24, 14:41, Ethan Carter Edwards wrote: > Refactor to use kcalloc instead of kzalloc when multiplying > allocation size by count. This refactor prevents unintentional > memory overflows. Discovered by checkpatch.pl. > > Signed-off-by: Ethan Carter Edwards > --- > drivers/cpufreq/sparc-us2e-cpufreq.c | 2 +- > drivers/cpufreq/sparc-us3-cpufreq.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/sparc-us2e-cpufreq.c b/drivers/cpufreq/sparc-us2e-cpufreq.c > index 8a0cd5312a59..15899dd77c08 100644 > --- a/drivers/cpufreq/sparc-us2e-cpufreq.c > +++ b/drivers/cpufreq/sparc-us2e-cpufreq.c > @@ -323,7 +323,7 @@ static int __init us2e_freq_init(void) > impl = ((ver >> 32) & 0xffff); > > if (manuf == 0x17 && impl == 0x13) { > - us2e_freq_table = kzalloc(NR_CPUS * sizeof(*us2e_freq_table), > + us2e_freq_table = kcalloc(NR_CPUS, sizeof(*us2e_freq_table), > GFP_KERNEL); > if (!us2e_freq_table) > return -ENOMEM; > diff --git a/drivers/cpufreq/sparc-us3-cpufreq.c b/drivers/cpufreq/sparc-us3-cpufreq.c > index b50f9d13e6d2..de50a2f3b124 100644 > --- a/drivers/cpufreq/sparc-us3-cpufreq.c > +++ b/drivers/cpufreq/sparc-us3-cpufreq.c > @@ -171,7 +171,7 @@ static int __init us3_freq_init(void) > impl == CHEETAH_PLUS_IMPL || > impl == JAGUAR_IMPL || > impl == PANTHER_IMPL)) { > - us3_freq_table = kzalloc(NR_CPUS * sizeof(*us3_freq_table), > + us3_freq_table = kcalloc(NR_CPUS, sizeof(*us3_freq_table), > GFP_KERNEL); > if (!us3_freq_table) > return -ENOMEM; Applied. Thanks. Though I failed to apply it directly using git/b4 for some reason, had to manually make the updates and commit. -- viresh