Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp349074lqb; Thu, 29 Feb 2024 02:55:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXDhlXzxJoxCplXIUK7ZsLSNEE09UT5/mpyPd2qMm+jyL2kN9yGBHyl23SsW9iI6INujG5EAYYSt2wqrpiJKxVZPKCSazGyhjU0tTIDLA== X-Google-Smtp-Source: AGHT+IHvA4+dvqJ8FwP/UaYB7UoQwFzyscqD7nGo0ae46Nu4CXZENoIZIRt4i3eyHdE9wZGAPvCs X-Received: by 2002:ad4:55e7:0:b0:68f:e924:adf4 with SMTP id bu7-20020ad455e7000000b0068fe924adf4mr1745921qvb.14.1709204138849; Thu, 29 Feb 2024 02:55:38 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gy13-20020a056214242d00b0068c8a251ee3si1081911qvb.469.2024.02.29.02.55.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 02:55:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=jWVZ0rdQ; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-86589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 048471C233CE for ; Thu, 29 Feb 2024 10:55:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6B7361665; Thu, 29 Feb 2024 10:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jWVZ0rdQ" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 622046351C; Thu, 29 Feb 2024 10:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709204081; cv=none; b=ueukYRqLzXuUDLTyfAC2KPtv2XlmXThvFaKBFpcRrmY+ccjtD0fT1uGp8tS+H1aeG3c38BQPxfn5TNnsm8IwXdnlID80EK2yay9seGsw/IXajCfDBsKpPyUd/aQ95p+XLfU9CI1LObNOvdNSJsHq4OoF2Uj/jEN6OAt6/Ik4CVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709204081; c=relaxed/simple; bh=SxVA8/lAGPXj7aJ44Uc6WXqxSXmTeZTF1kbZzTL+u+8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uS5AGxik6qVQDELx2dwlrEgzEJpws+gYIkolw2pZnjrg2/24k9mS2euJ5zz4hAwAHWK1dnaUPqP/9woqa1DDKjUgqegyW0rAq95I8irRcgWk3R4ioNK8PdcEDk/l1ARcnuWGwSpTR2shoTNvmUHPcq+CgZBwAhQfAJ+WJDNvJtE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jWVZ0rdQ; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709204081; x=1740740081; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=SxVA8/lAGPXj7aJ44Uc6WXqxSXmTeZTF1kbZzTL+u+8=; b=jWVZ0rdQt5go+ZpxRpiDtn6ggJHBJsD42o6n+qWqRJsoH7DO2KLPZQQY qRUZ9t3s9H5wuMKbcn3j78vTeEjRkv2SGzZJvlComnEOHIsZMcyLcUz/6 Ohothe0O1oSRRDkUxrYeZV4xWAwXHFT6SM/Gm5enrQUZCokdhtJD7Ib2Q zpvzwjI17Lda0OEQIuW0v6FClOi6pyRUuJ87p1I0X8brVlh4oOF3DdE1L CTHmkRmak51Hedc0QV7xaEe2IhsZP1Jn7dhxzPokMjLHlXS1csClwskgI bXsRzJYjQ3vitpBII1MrMCGoLUqlh7o2uzKAs1XoUgOQpnn8iVdDM664k w==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="21122607" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="21122607" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 02:54:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="913978961" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="913978961" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 02:54:35 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rfe3b-00000008e8j-2Ooc; Thu, 29 Feb 2024 12:54:31 +0200 Date: Thu, 29 Feb 2024 12:54:31 +0200 From: Andy Shevchenko To: Kees Cook Cc: Jakub Kicinski , Vinod Koul , Linus Walleij , Jonathan Cameron , Mark Brown , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-spi@vger.kernel.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , "David S. Miller" , Eric Dumazet , Paolo Abeni , "Gustavo A. R. Silva" Subject: Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs Message-ID: References: <20240228204919.3680786-1-andriy.shevchenko@linux.intel.com> <20240228204919.3680786-8-andriy.shevchenko@linux.intel.com> <202402281341.AC67EB6E35@keescook> <20240228144148.5c227487@kernel.org> <202402281554.C1CEEF744@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202402281554.C1CEEF744@keescook> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Wed, Feb 28, 2024 at 04:01:49PM -0800, Kees Cook wrote: > On Wed, Feb 28, 2024 at 02:41:48PM -0800, Jakub Kicinski wrote: > > On Wed, 28 Feb 2024 13:46:10 -0800 Kees Cook wrote: .. > But I still like the idea -- Gustavo has been solving these cases with > having two structs, e.g.: > > struct net_device { > ...unchanged... > }; > > struct net_device_alloc { > struct net_device dev; > u32 priv_size; > u8 priv_data[] __counted_by(priv_size) __aligned(NETDEV_ALIGN); > }; > > And internals can use struct net_device_alloc... I just realized that I made same approach in f6d7f050e258 ("spi: Don't use flexible array in struct spi_message definition") 75e308ffc4f0 ("spi: Use struct_size() helper") -- With Best Regards, Andy Shevchenko