From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74439C3271E for ; Mon, 8 Jul 2024 07:30:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 2E94940512; Mon, 8 Jul 2024 07:30:01 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 4zVlTNbW_AXW; Mon, 8 Jul 2024 07:30:00 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2120640463 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1720423800; bh=kiut70aOGdyd/ifTH+RPk2Fo2WrYA8HQrg7pPfg9eII=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=COkGkvoZXgFvwMQGtO+N4SHKYNvWX0s8wAL1DohB+55L3sjgaoMhIkQyYD4fOyGFE CI+Ci9j9Z9+wpzCU+uaebbNh7l3kxSi/II/H/+1zyKFqkadVz9bCahmM1+A5jDYdKF BKkML7YYzyKYm+KstOJPPEnOOQH/QaXNzqUoqb+JSVnHg8al17FlsHJTCznaas6pOx sk2fGPG/yhQl3NDGK2fkObIweqBFmuDDQ3GR0vr8Euf90U+ImoJvjS0yPBr9tktq0m Np0c9gb75iFWQA3FQCxj3CVZ7HSHtFOKMbdkmZlm61HTOU6MD6105D8TV8kvFizsJ1 bPLijubHafn0Q== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 2120640463; Mon, 8 Jul 2024 07:30:00 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id A31D81BF425 for ; Mon, 8 Jul 2024 07:29:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8F9246069A for ; Mon, 8 Jul 2024 07:29:58 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id PPY-96HTzjid for ; Mon, 8 Jul 2024 07:29:57 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 8FD40605FC DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8FD40605FC Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8FD40605FC for ; Mon, 8 Jul 2024 07:29:57 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4A2B3602E0; Mon, 8 Jul 2024 07:29:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95F36C116B1; Mon, 8 Jul 2024 07:29:53 +0000 (UTC) Date: Mon, 8 Jul 2024 08:29:51 +0100 From: Simon Horman To: Aleksandr Mishin Message-ID: <20240708072951.GG1481495@kernel.org> References: <20240706140518.9214-1-amishin@t-argos.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240706140518.9214-1-amishin@t-argos.ru> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720423796; bh=A0I4MzbtTvvJyJRp/JKnljUts9C+tJ9eYvgSqnXk+fY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LegcvPgfnxhyjE3ZR5ztSBdKfj41ZUFxx9ukexiWhuRoebuEsGdT/SMlWmHX34FaD VSBCQ49fxtDb1tBMYZisJHpk+s7kGfKbTRxusze8fg6S+QoTlm4fMsTMrpCDw3U2j+ x7PG4XEort6jBSpDWMDBfLnnSk1FYSYagJzmiX301zhXA2kj1G1WfKVInU7Zvz8l/g xODBMX5473EfNgGuerxBisMJKRPE9iTmQQ4DwI7Ihd1c4GQE4PxvR5zPXXwCc6d1dK bJOBkzb5YBekS8wGoOe65SqvskxqjsPkoq7v7it5cFLuRc929B9szuVhDxCC5TWY7P 6IZYMGOvu7aZg== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=LegcvPgf Subject: Re: [Intel-wired-lan] [PATCH net-next v2] ice: Adjust over allocation of memory in ice_sched_add_root_node() and ice_sched_add_node() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvc-project@linuxtesting.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, Anirudh Venkataramanan , Tony Nguyen , netdev@vger.kernel.org, Jakub Kicinski , Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Sat, Jul 06, 2024 at 05:05:18PM +0300, Aleksandr Mishin wrote: > In ice_sched_add_root_node() and ice_sched_add_node() there are calls to > devm_kcalloc() in order to allocate memory for array of pointers to > 'ice_sched_node' structure. But in this calls there are 'sizeof(*root)' > instead of 'sizeof(root)' and 'sizeof(*node)' instead of 'sizeof(node)'. > So memory is allocated for structures instead pointers. This lead to > significant over allocation of memory. > > Adjust over allocation of memory by correcting devm_kcalloc() parameters. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Suggested-by: Simon Horman FTR, I did provide some review of v1. But I don't think that counts as suggesting this patch. > Signed-off-by: Aleksandr Mishin > --- > v2: > - Update comment, remove 'Fixes' tag and change the tree from 'net' to > 'net-next' as suggested by Simon > (https://lore.kernel.org/all/20240706095258.GB1481495@kernel.org/) > v1: https://lore.kernel.org/all/20240705163620.12429-1-amishin@t-argos.ru/ Also, v2 was sent less than 24h after v1, please don't do that when posting patches to netdev. Please do read https://docs.kernel.org/process/maintainer-netdev.html ... From mboxrd@z Thu Jan 1 00:00:00 1970 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 653B41CD15; Mon, 8 Jul 2024 07:29:56 +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=1720423796; cv=none; b=Pp/453zdfJV7LoKFJh2itY3G9NlRUqiHNluqVhTMgYw5wn4y1J6U9WN3xahDIQdrkrWjbFIN3oCy2Jf9sVcy4/35owt24eKo2u6nrSanskVb8AjWrrtDUDsAdDdrcZGHPqkYUJWxmSp+nxIBnKwnv66cTvXF/LHjao5lITmDh/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720423796; c=relaxed/simple; bh=A0I4MzbtTvvJyJRp/JKnljUts9C+tJ9eYvgSqnXk+fY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=okZcPYdIii2WLfMkAA7clrYuKWW6gcrVIFOFxNYrg5YkVtQ5u1JKjtVy7V8F3TMN2mavXgVAGKfqUKDGjSPRqVk744mQFU18xAEsoni4APzUVlHM5nKc29nvGwnwkO8jWNaxgJopLtUdZBTlyBKSPF+qgNF6okGBzp4ZwETAxnw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LegcvPgf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LegcvPgf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95F36C116B1; Mon, 8 Jul 2024 07:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720423796; bh=A0I4MzbtTvvJyJRp/JKnljUts9C+tJ9eYvgSqnXk+fY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LegcvPgfnxhyjE3ZR5ztSBdKfj41ZUFxx9ukexiWhuRoebuEsGdT/SMlWmHX34FaD VSBCQ49fxtDb1tBMYZisJHpk+s7kGfKbTRxusze8fg6S+QoTlm4fMsTMrpCDw3U2j+ x7PG4XEort6jBSpDWMDBfLnnSk1FYSYagJzmiX301zhXA2kj1G1WfKVInU7Zvz8l/g xODBMX5473EfNgGuerxBisMJKRPE9iTmQQ4DwI7Ihd1c4GQE4PxvR5zPXXwCc6d1dK bJOBkzb5YBekS8wGoOe65SqvskxqjsPkoq7v7it5cFLuRc929B9szuVhDxCC5TWY7P 6IZYMGOvu7aZg== Date: Mon, 8 Jul 2024 08:29:51 +0100 From: Simon Horman To: Aleksandr Mishin Cc: Anirudh Venkataramanan , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH net-next v2] ice: Adjust over allocation of memory in ice_sched_add_root_node() and ice_sched_add_node() Message-ID: <20240708072951.GG1481495@kernel.org> References: <20240706140518.9214-1-amishin@t-argos.ru> 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: <20240706140518.9214-1-amishin@t-argos.ru> On Sat, Jul 06, 2024 at 05:05:18PM +0300, Aleksandr Mishin wrote: > In ice_sched_add_root_node() and ice_sched_add_node() there are calls to > devm_kcalloc() in order to allocate memory for array of pointers to > 'ice_sched_node' structure. But in this calls there are 'sizeof(*root)' > instead of 'sizeof(root)' and 'sizeof(*node)' instead of 'sizeof(node)'. > So memory is allocated for structures instead pointers. This lead to > significant over allocation of memory. > > Adjust over allocation of memory by correcting devm_kcalloc() parameters. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Suggested-by: Simon Horman FTR, I did provide some review of v1. But I don't think that counts as suggesting this patch. > Signed-off-by: Aleksandr Mishin > --- > v2: > - Update comment, remove 'Fixes' tag and change the tree from 'net' to > 'net-next' as suggested by Simon > (https://lore.kernel.org/all/20240706095258.GB1481495@kernel.org/) > v1: https://lore.kernel.org/all/20240705163620.12429-1-amishin@t-argos.ru/ Also, v2 was sent less than 24h after v1, please don't do that when posting patches to netdev. Please do read https://docs.kernel.org/process/maintainer-netdev.html ...