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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 09407C54EE9 for ; Thu, 22 Sep 2022 16:01:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01D1C10EC60; Thu, 22 Sep 2022 16:01:14 +0000 (UTC) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6570B10EC5A for ; Thu, 22 Sep 2022 16:00:29 +0000 (UTC) Received: by mail-pl1-x62f.google.com with SMTP id l10so9172629plb.10 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=Mo5MyHW+2n9ivTm1SyXgPxVtyZx+GttwAc9liKs+FshcmOp7jMY85nntskndaeCbs2 2Q8uTP3MKe958Wcvwz84IFD8z9cYjQgtO6XljIRADbS38U5laL71RcppHWentFGa3/ju o3QVDq7Fbxk62QgFx9EEPnZTusu9U2xd+eahgrJf1S+B/7e6uia6r+2k/524FRfMdC0e 4265lRilKG6x6lxrJ/O+7Ja2/T1VpQ49ZqxyrExzNyqOYUvAFIkLXe+HLAb+hOE2pG/z utENHX2mc3GXBLVLFIgyl1bLmubSfUyx9/1xMdZWU8KPbj3JS0EL5zK711E4MHlUGpTH MUbg== X-Gm-Message-State: ACrzQf1JbgrAv9mhU4gOW6NhHTk2/Zn584VH1XDTWDMQdCMb4BsrzPJh pzRJSLcWnf4N3dKPZjlFVa1iRA== 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" 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Feng Tang , Nick Desaulniers , "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 , Andrew Morton , Vlastimil Babka , Alex Elder , Greg Kroah-Hartman , "linux-wireless@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Christian =?iso-8859-1?Q?K=F6nig?= , Pekka Enberg , Daniel Micay , "netdev@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Joonsoo Kim , "David S. Miller" , "linux-btrfs@vger.kernel.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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