[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM5PR11MB13241226F3AACC81398F7E8EC14E9@DM5PR11MB1324.namprd11.prod.outlook.com>
Date: Thu, 22 Sep 2022 15:56:54 +0000
From: "Ruhl, Michael J" <michael.j.ruhl@...el.com>
To: Kees Cook <keescook@...omium.org>, Vlastimil Babka <vbabka@...e.cz>
CC: "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
"Jacob Shin" <jacob.shin@....com>,
"llvm@...ts.linux.dev" <llvm@...ts.linux.dev>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Eric Dumazet <edumazet@...gle.com>,
"Nguyen, Anthony L" <anthony.l.nguyen@...el.com>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
"Sumit Semwal" <sumit.semwal@...aro.org>,
"dev@...nvswitch.org" <dev@...nvswitch.org>,
"x86@...nel.org" <x86@...nel.org>,
"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
David Rientjes <rientjes@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>, Yonghong Song <yhs@...com>,
Paolo Abeni <pabeni@...hat.com>,
"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
Marco Elver <elver@...gle.com>,
Josef Bacik <josef@...icpanda.com>,
"linaro-mm-sig@...ts.linaro.org" <linaro-mm-sig@...ts.linaro.org>,
Jakub Kicinski <kuba@...nel.org>,
"David Sterba" <dsterba@...e.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Alex Elder <elder@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Nick Desaulniers" <ndesaulniers@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Pekka Enberg <penberg@...nel.org>,
Daniel Micay <danielmicay@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"Andrew Morton" <akpm@...ux-foundation.org>,
Christian König <christian.koenig@....com>,
"linux-btrfs@...r.kernel.org" <linux-btrfs@...r.kernel.org>
Subject: RE: [PATCH 07/12] igb: Proactively round up to kmalloc bucket size
>-----Original Message-----
>From: dri-devel <dri-devel-bounces@...ts.freedesktop.org> On Behalf Of
>Kees Cook
>Sent: Wednesday, September 21, 2022 11:10 PM
>To: Vlastimil Babka <vbabka@...e.cz>
>Cc: linux-wireless@...r.kernel.org; Jacob Shin <jacob.shin@....com>;
>llvm@...ts.linux.dev; dri-devel@...ts.freedesktop.org; linux-mm@...ck.org;
>Eric Dumazet <edumazet@...gle.com>; Nguyen, Anthony L
><anthony.l.nguyen@...el.com>; linux-hardening@...r.kernel.org; Sumit
>Semwal <sumit.semwal@...aro.org>; dev@...nvswitch.org; x86@...nel.org;
>Brandeburg, Jesse <jesse.brandeburg@...el.com>; intel-wired-
>lan@...ts.osuosl.org; David Rientjes <rientjes@...gle.com>; Miguel Ojeda
><ojeda@...nel.org>; Yonghong Song <yhs@...com>; Paolo Abeni
><pabeni@...hat.com>; linux-media@...r.kernel.org; Marco Elver
><elver@...gle.com>; Kees Cook <keescook@...omium.org>; Josef Bacik
><josef@...icpanda.com>; linaro-mm-sig@...ts.linaro.org; Jakub Kicinski
><kuba@...nel.org>; David Sterba <dsterba@...e.com>; Joonsoo Kim
><iamjoonsoo.kim@....com>; Alex Elder <elder@...nel.org>; Greg Kroah-
>Hartman <gregkh@...uxfoundation.org>; Nick Desaulniers
><ndesaulniers@...gle.com>; linux-kernel@...r.kernel.org; David S. Miller
><davem@...emloft.net>; Pekka Enberg <penberg@...nel.org>; Daniel
>Micay <danielmicay@...il.com>; netdev@...r.kernel.org; linux-
>fsdevel@...r.kernel.org; Andrew Morton <akpm@...ux-foundation.org>;
>Christian König <christian.koenig@....com>; linux-btrfs@...r.kernel.org
>Subject: [PATCH 07/12] igb: Proactively round up to kmalloc bucket size
>
>Instead of having a mismatch between the requested allocation size and
>the actual kmalloc bucket size, which is examined later via ksize(),
>round up proactively so the allocation is explicitly made for the full
>size, allowing the compiler to correctly reason about the resulting size
>of the buffer through the existing __alloc_size() hint.
>
>Cc: Jesse Brandeburg <jesse.brandeburg@...el.com>
>Cc: Tony Nguyen <anthony.l.nguyen@...el.com>
>Cc: "David S. Miller" <davem@...emloft.net>
>Cc: Eric Dumazet <edumazet@...gle.com>
>Cc: Jakub Kicinski <kuba@...nel.org>
>Cc: Paolo Abeni <pabeni@...hat.com>
>Cc: intel-wired-lan@...ts.osuosl.org
>Cc: netdev@...r.kernel.org
>Signed-off-by: Kees Cook <keescook@...omium.org>
>---
> drivers/net/ethernet/intel/igb/igb_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/net/ethernet/intel/igb/igb_main.c
>b/drivers/net/ethernet/intel/igb/igb_main.c
>index 2796e81d2726..4d70ee5b0f79 100644
>--- a/drivers/net/ethernet/intel/igb/igb_main.c
>+++ b/drivers/net/ethernet/intel/igb/igb_main.c
>@@ -1196,6 +1196,7 @@ static int igb_alloc_q_vector(struct igb_adapter
>*adapter,
>
> ring_count = txr_count + rxr_count;
> size = struct_size(q_vector, ring, ring_count);
>+ size = kmalloc_size_roundup(size);
why not:
size = kmalloc_size_roundup(struct_size(q_vector, ring, ring_count));
?
m
> /* allocate q_vector and rings */
> q_vector = adapter->q_vector[v_idx];
>--
>2.34.1
Powered by blists - more mailing lists