From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 222D3385D9C for ; Mon, 8 Jun 2026 07:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780902545; cv=none; b=DThuCh5mT6TmffclGkXEd/56hpsdtBXbNnGsPb/SMZWj/c0AMt2sdOzkLzk2jgXlmKcvjXFI6bjUSnVgOb/1Y3JPm7DGQILBq/qibnjiXzgIpT9MF/wiMnVmxtLdnQXH7Ppahs2Bcrae4Kjw+QyqEBMRMpiiORMKvtc8w4Ou8dw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780902545; c=relaxed/simple; bh=x4YGxnUH6nSF5/ZhKRoPbEMOQVVMlItMWOWI/c6CpGk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lAPe2MCGtg2bjdS0NdF8HgRIAR7fpiP17DmQ4pUJZXn9zkKuaohiHxnGeJ9r/QXhHr3d56tf83V6AW4q2P09Z2IwLmNSbxz4QspXOpVt3Zo/1b75jtA/KtnmTBNKE2sR7KVEhnZT7xCvKJzwvt38KXnaQSdxdRWHQEM/Vcfu+h4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MWClvn55; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MWClvn55" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-490abf12f0fso19426745e9.0 for ; Mon, 08 Jun 2026 00:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780902541; x=1781507341; 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=otSzr2Y0wGW3RXTk64Kspnpz7/ygAtHA4NuNzYHMC48=; b=MWClvn55UeLFGgNjzWAePIlK/B7iknzIXQMaKFe584rHDAVfCJs7/fUFJ59XhPg4e0 +edsEzHd88RlF+AG/GgJuCT0kW9iUhK8yEqQET+urZA88lqNXnNDOnJ9RGyVeBtx2Ow+ oVOulf9wMuygGSfVXwvtshw6pMYfJuMHjgeLm3XbQ7XDJFwnZ8Mm/rWF2jXZwoEeeG/M Vlaoff/JQILyOkc7y7Ge3wAr3/mD0F+I7o7mSIGXX3Ai3LHJN0vL4lpWh39B2EVOO+Os zcdO0xQavBs4BFU5wJzv+7StPFZ1ujR8eeu+ZZL7ES+qdyvT/es7UlNkwoHNVdJDBUH1 VRqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780902541; x=1781507341; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=otSzr2Y0wGW3RXTk64Kspnpz7/ygAtHA4NuNzYHMC48=; b=Ia2plXvJQ6EARXPJUKxfcU/dJTUUnHTAVU3dDnme4ufqUSGaV52pFHr3QO8hF8eQAB p+10GUn6IFC8uE1Xa3g0Uz8qJIahRC9ANBsSI+RQPzHbW9i7sB/5cQiLfJzf+igTPlus zMabTz+HF3yxA7Kwl6SolTymHAvYcBIxaGClBiYvLPkw+5KNR1qNUflDuuIzInULO3uj htzssYyvCzH1Ve92muIez9QJzP968a/BNyS7V2OoSN5FspcxU6HuqHJgeRmhS5Cc6bBC 4EFj3KjNCMF1HrZjY0dagFW/IQO+B6ajrUyovq/+WKAse+byVTklLbn2zCVXGmfJ7pff 4tag== X-Forwarded-Encrypted: i=1; AFNElJ8Yn/GPg8GUDHRgfU0+TtMEriDJXIL0pHOhsXWJ92gFykbUTnSn9ltJlOVx7LEsiODgZuJeDXv8PrFSnKg=@vger.kernel.org X-Gm-Message-State: AOJu0YwtwlPxZURPJAWcR7QUM1BiSCoLfQMopIuGkzhrd0LzQWQfxO+x ZwI/LUZV8QUxpnMo+vSEa5LTeIxN0MAuufm6de9SYnpSRabafi7f/i+r X-Gm-Gg: Acq92OF6hcEu4YxwBx953DgrVO989rco+lzSw2/cVuyPjxWfSUlVe8HLRwS27DHd/Ib 1iZX9oH5d8Va7JH9udz90hv+Er79rLNS1vstSMjqm0sQ2z2fy0mSLR6YrOD4IN3IG+qXxbIxsGq muB2GB98Vv32+b7nIF0BkhSwkdx/tvJh6q0avJVzt4mZtZwfw8NfKQzP34UizfJEaj9T6piovEA Vbk25nFz9uPe/z3SPxlP57opM706VhYOl1uguO4ushFsaRHQE+52z4VeW6r8tGQiiWsyrpa5K0H KEi0FvsRRT3kyb7mXBuxZUmb5FPS16Cju93s59U88oHe4yRo+Ge2TuoOyXCNrG1b3SLO2jLxuVf rly67jeUjX7tzbNPSL+8Nfwa+pYG/9tedbrVFz11Bj+Q9r9gNRmLiOqUmIPvZpctFcduJSKQubQ EfQ82zL2V5TqsZET+vyF9nBunpNtHaJhbesYWWkb4G X-Received: by 2002:a05:600c:8208:b0:490:ad1e:1846 with SMTP id 5b1f17b1804b1-490c2cf6718mr175596575e9.9.1780902541391; Mon, 08 Jun 2026 00:09:01 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490c2d37edbsm276118055e9.2.2026.06.08.00.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 00:09:00 -0700 (PDT) Date: Mon, 8 Jun 2026 10:08:57 +0300 From: Dan Carpenter To: Andrew Soto Cc: hansg@kernel.org, mchehab@kernel.org, gregkh@linuxfoundation.org, andy@kernel.org, sakari.ailus@linux.intel.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: media: atomisp: prefer kcalloc over kzalloc with multiply Message-ID: References: <20260606234427.9902-1-linux@notrealandy.dev> 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: <20260606234427.9902-1-linux@notrealandy.dev> On Sat, Jun 06, 2026 at 11:44:27PM +0000, Andrew Soto wrote: > Optimize memory allocation layout This part of the commit message is techno-bable. It's just words that don't mean anything. I suppose teally they do mean something, but it's not what the patch does... > in sh_css_params.c by replacing the raw multiplication inside kzalloc() with a type-safe kcalloc() array allocation wrapper. > > This prevents potential integer overflow vulnerabilities by validating the array size calculations before interacting with the kernel heap allocator, aligning the driver with modern kernel memory allocation standards. > There is no risk of integer overflow when we multiply by 1. > Signed-off-by: Andrew Soto > --- > drivers/staging/media/atomisp/pci/sh_css_params.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c > index fcebace11..9147ca047 100644 > --- a/drivers/staging/media/atomisp/pci/sh_css_params.c > +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c > @@ -3716,7 +3716,7 @@ ia_css_ptr sh_css_store_sp_group_to_ddr(void) > > IA_CSS_ENTER_LEAVE_PRIVATE("void"); > > - write_buf = kzalloc(sizeof(u8) * 8192, GFP_KERNEL); > + write_buf = kcalloc(8192, sizeof(u8), GFP_KERNEL); This should just be: write_buf = kzalloc(8192, GFP_KERNEL); If we weren't allocating a text buffer then the new way to write this would be using kzalloc_objs(). regards, dan carpenter