Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1031495rwb; Thu, 22 Sep 2022 09:14:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XrlubSdgrK5zeIeVr8viUp9jcxQjBGI1fuy4B+d7obsA+cy1UuDJSlIreoc3oDQScDyGM X-Received: by 2002:a17:906:8477:b0:77d:185a:b443 with SMTP id hx23-20020a170906847700b0077d185ab443mr3489216ejc.311.1663863249231; Thu, 22 Sep 2022 09:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663863249; cv=none; d=google.com; s=arc-20160816; b=EA2gXnVst7oXIHAEhIZvymECVk8CSr+Sch5szg7mXIhdkVeunmCq3lXjmi1h+fzcuH Fe7ZEZVgbJpSv8prbgOE7Y2YcJLir5kaK5AswTDaCpDOdI4gPSRGmNHmT3fReEOZA0to 7fPjOhADxlSS9Vs3eHeKK97g/qsH1Ty/X1kzSPEbCHVPMsj8dlDtgsfFf4nCoCclWQ/T fMSoY66v8ZB+OJA8rsHquaAoKxfw3NelDrnSYb5T8ecnLm1q6tFf1Xps5jGAvzvLxQBA eaIE9pLNs0b3UtusOD47heMqf2R0wS/kiHv7HweQyEBxUJxNJypIz/RFh4UEhnV87AXn K/gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=e+3VYhs+DuwH7bu+QHtV1rjWq3mJNnHisCvMMFS3bAw=; b=DpbTp3+f3Gb9tr8UnT3mBsZd/JemrAs7CFJ8mRpjy8PUmc/EHlmdoBim/VVto6dsFq PDWKMLxxKVN1SvJCcdi20PNXExHlvSEqPjDLzZlzlHaa1Snn29Eh9Qtvo+XcOzsSg4rD 0KDDh9Xa3PKt30FMZ50fYdx2VGTY0IB2DOj7TsURPSHlCPZ9FFGc/j3kz3gWhsjKtu0q Y1qcOhR+zfGj9O0vEEl6pXU7A82bCbcQSwHdi/WgO+ytow5OiXcHmdbiZ79508/lj5lJ yI8KO09Qog+KxBix5VRmdxZjiq8v4opbEXRs6wA/eAbzOPACq6lQHYYgWc4fFL/ncv8/ bwYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XxhEWZKe; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a1709060f9400b007806c7c3fc1si4633897ejj.975.2022.09.22.09.13.52; Thu, 22 Sep 2022 09:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XxhEWZKe; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbiIVQAc (ORCPT + 63 others); Thu, 22 Sep 2022 12:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbiIVQAb (ORCPT ); Thu, 22 Sep 2022 12:00:31 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71A9CA99F7 for ; Thu, 22 Sep 2022 09:00:29 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id b21so9188253plz.7 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=7VoTCbGpJ+ividgij733qkO031mTBpinS9cFMQAd/DZfjfx3gchoL12skujbEgGRwF AurQ1Fqi1vSMFo5vjOGj8pEnmBM7HCIIaMnrfgpbpPgQ6ACASdsPKPFXk56x5Ib71Dak bzllAlankY3nHP8zicriLZ55KUfs1erRdoHu4O/dWUGzH42/yeQZrvgeKf5qgBC5d0MF yP/plEUSzYUjMdvUKexUsXpxlix6d7T/vCzY12kXkOxsuVioohR2bwRswQxN2oYbmeUi G/hywZ1gJtKkiTn3t+GB3D3bTbEX5Wy9CeDgC7SVbvPr/U43ARsZ/I37bRdn0n18cvhH tGEA== X-Gm-Message-State: ACrzQf0fD4GZhfDa+AILl3cB3q2PBbh00jDw4y4CUybV8gPygpXAk4Zh ILZA5iWIF/oUNEeQymek8bfoSA== 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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