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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6336C6FA90 for ; Thu, 22 Sep 2022 16:00:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230371AbiIVQAc (ORCPT ); Thu, 22 Sep 2022 12:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbiIVQAb (ORCPT ); Thu, 22 Sep 2022 12:00:31 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73679A99FD for ; Thu, 22 Sep 2022 09:00:29 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id q15-20020a17090a304f00b002002ac83485so2649443pjl.0 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=AX9CXkrgBngndqZ8976BJxK6Fhxt9X0qCjBloa9TlJrideRpNu2QXxX0Ie7gpnpv4q hj5KXQd9ggWdrNhUfgb9MH0YsIVmRHo9pANQ1n5Pn9RA092txWByO5pbR42eA6pbYRvJ B8Je9AfqvHfwuBzuxTjBR4BTF5dz2N4km8owG6eDw7tUatavuBieyYCuQ0iYKDNqxmAT 52y2M8+k2U7Iln6asOzqZRXSEhajwyt1J7YZuqYlyA3HbncDgMy22W9EeJoslAnnI2+w B2Jdtit0BBN1PZxrzj33FIOZDs+uAtoPLly18ULNHWaW4I5MKmMLSfKtdWTnrJjMZ9Z/ OVVA== X-Gm-Message-State: ACrzQf2Q/BdHMp7fCL3K3zFyIlYXyZspC3hzupRUhEpDHz3tUcgYioyc zZMf0Oz7oDS14lPOcUHeD83ksg== 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-hardening@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