From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 779D566E8 for ; Thu, 22 Sep 2022 16:00:29 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id v1so9181595plo.9 for ; Thu, 22 Sep 2022 09:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=e+3VYhs+DuwH7bu+QHtV1rjWq3mJNnHisCvMMFS3bAw=; b=XxhEWZKeaIg8g+YPuHc57mvNIPPhpigg738nM9wsLJjiUYpKwjJNzBKKGjefZOhAzi 0KqHQ1P/cHiMmQgsO3z2jt2+D0oCcG8Ck+pj5sopXZOTE33QKhSQ8Lb6DWDYvG77ZJIc GQLx6jVnYAJuMY3HV3uGUN51p3PNgpWkx9A1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=e+3VYhs+DuwH7bu+QHtV1rjWq3mJNnHisCvMMFS3bAw=; b=zNBGscmmW3nHVWiHkp0FMeG/GkjMcHCe/2q5oZLYhPMIV3fvX0hrDM01X/h01uSfil f4GX2c7IOPzD1EnkBVmllVt2BlB+rNZLEhZmVzuilzcG8cxGNnnoFQQxoHcYZqKLgzwD Ec0L8zPME2JvtQGSsayIaPx3GFJT+pHkK8sRBKLYeR8zelrlbFs/dKlIf8bS1pwdfILG UbCH1M5GMUbAFRO1r0lWXvRRTBkdsN/y6oYjjO5oRCf8uNT+frHMfhNX4YcYaGoISbRD Cny4aDFEX9ajkOBtfoYwymMzH2BeRB5YceWMfY/0XrcJVP3yskn6Hjai3lJqQ7hI7K2n Eb6g== X-Gm-Message-State: ACrzQf1iKVklK2y2MIVkBM8Wro9lDyepy2/ANj9syRmh/Is+ktLc2SwD Pejvj8/2NawG3hL6SHiRX5UfmA== X-Google-Smtp-Source: AMsMyM6q4mhFYq39gGoVyx6Hnh47y8QFV1PKitfWXVTUQGpGwPy/JbIncPBlq3WqciXD78b9y3HP3A== X-Received: by 2002:a17:90b:164d:b0:202:69b3:1002 with SMTP id il13-20020a17090b164d00b0020269b31002mr4362502pjb.86.1663862428935; Thu, 22 Sep 2022 09:00:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id ms3-20020a17090b234300b002005c3d4d4fsm4007085pjb.19.2022.09.22.09.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 09:00:28 -0700 (PDT) Date: Thu, 22 Sep 2022 09:00:26 -0700 From: Kees Cook To: "Ruhl, Michael J" Cc: Vlastimil Babka , "linux-wireless@vger.kernel.org" , Feng Tang , "llvm@lists.linux.dev" , "dri-devel@lists.freedesktop.org" , "linux-mm@kvack.org" , Eric Dumazet , "Nguyen, Anthony L" , "linux-hardening@vger.kernel.org" , Sumit Semwal , "dev@openvswitch.org" , "x86@kernel.org" , "Brandeburg, Jesse" , "intel-wired-lan@lists.osuosl.org" , David Rientjes , Miguel Ojeda , Yonghong Song , Paolo Abeni , "linux-media@vger.kernel.org" , Marco Elver , Josef Bacik , "linaro-mm-sig@lists.linaro.org" , Jakub Kicinski , David Sterba , Joonsoo Kim , Alex Elder , Greg Kroah-Hartman , Nick Desaulniers , "linux-kernel@vger.kernel.org" , "David S. Miller" , Pekka Enberg , Daniel Micay , "netdev@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Andrew Morton , Christian =?iso-8859-1?Q?K=F6nig?= , "linux-btrfs@vger.kernel.org" Subject: Re: [PATCH 07/12] igb: Proactively round up to kmalloc bucket size Message-ID: <202209220859.DA21F91EAE@keescook> References: <20220922031013.2150682-1-keescook@chromium.org> <20220922031013.2150682-8-keescook@chromium.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Sep 22, 2022 at 03:56:54PM +0000, Ruhl, Michael J wrote: > >From: dri-devel On Behalf Of Kees Cook > [...] > >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)); > > ? Sure! I though it might be more readable split up. I will change it. :) -- Kees Cook