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 6BE94C4332F for ; Fri, 4 Nov 2022 20:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbiKDUyf (ORCPT ); Fri, 4 Nov 2022 16:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbiKDUy2 (ORCPT ); Fri, 4 Nov 2022 16:54:28 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F65A1A83F for ; Fri, 4 Nov 2022 13:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667595268; x=1699131268; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/R0z4aupX7lJqYocNjduZT81fH5/p0hOTKZ7meDTBH0=; b=A7pSN4GHYoZwBIJwuGVPAv6GcSuXyJfdTNug/khz5N53FMltON7grpQG HDqjySuT6v3M+8gyLjthXKuwTPXoVUzuA2g/fvVRgRGRO0o6ce6OonL3M OtYRDS0VNZ/SyxzaOBCNZbAyvJVX0SIhNutPCDRNO2dZhU/Kj4myYyFNp GltTjom/JFFGp0amZ2WUwWV/eHiB1OY60jlXj8Wet+PGWXoFOdhzKv1eJ F2sqo0IDglOcj8M328/l/igpdgtY3IPfgrIDkRYV42/QT7wRE90HOtlTv Loq4BRDrQXMLJ2g0siXRYSPh9b2KsQ0gvqii7pHB0ghSh96qybu029qqw A==; X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="372177369" X-IronPort-AV: E=Sophos;i="5.96,138,1665471600"; d="scan'208";a="372177369" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 13:54:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="637716220" X-IronPort-AV: E=Sophos;i="5.96,138,1665471600"; d="scan'208";a="637716220" Received: from anguy11-desk2.jf.intel.com ([10.166.244.147]) by fmsmga007.fm.intel.com with ESMTP; 04 Nov 2022 13:54:27 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com Cc: Kees Cook , netdev@vger.kernel.org, anthony.l.nguyen@intel.com, Jesse Brandeburg , intel-wired-lan@lists.osuosl.org, Gurucharan , "Michael J . Ruhl" Subject: [PATCH net-next 6/6] igb: Proactively round up to kmalloc bucket size Date: Fri, 4 Nov 2022 13:54:14 -0700 Message-Id: <20221104205414.2354973-7-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221104205414.2354973-1-anthony.l.nguyen@intel.com> References: <20221104205414.2354973-1-anthony.l.nguyen@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Kees Cook In preparation for removing the "silently change allocation size" users of ksize(), explicitly round up all q_vector allocations so that allocations can be correctly compared to ksize(). Cc: Jesse Brandeburg Cc: Tony Nguyen Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Tested-by: Gurucharan (A Contingent worker at Intel) Reviewed-by: Michael J. Ruhl Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/igb/igb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index c2bb658198bf..97290fc0fddd 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -1195,7 +1195,7 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter, return -ENOMEM; ring_count = txr_count + rxr_count; - size = struct_size(q_vector, ring, ring_count); + size = kmalloc_size_roundup(struct_size(q_vector, ring, ring_count)); /* allocate q_vector and rings */ q_vector = adapter->q_vector[v_idx]; -- 2.35.1