Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp106601lqc; Thu, 29 Feb 2024 11:37:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU/7GGYsAeWebQk7x7oMer0CZgg70hN5OpANCcwZBRJtbV51M73aPrPEWeTGV2LGXmve2lPgZMMzAxB8u7nAaFaYSVguo/KxQfYSIYmfw== X-Google-Smtp-Source: AGHT+IGPSfkIHOkJ3akRC73yxNgj/08PAoNf29uqCA4s4WKrPX9fm6GuWAEfeQvZTNyjLqGOhFr/ X-Received: by 2002:a17:906:dfca:b0:a3f:b26e:139 with SMTP id jt10-20020a170906dfca00b00a3fb26e0139mr2080234ejc.39.1709235443082; Thu, 29 Feb 2024 11:37:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709235443; cv=pass; d=google.com; s=arc-20160816; b=RMpKXo9EYAeAqp1mcPzrPHvQOjMxlUDCjEANANfLGfLPf+3uGL54Y1r/KvRneR8gZH MshxNQYKK1G/DiUFp9vYxXGMHejoUhEUuCK2/UzFbImYrw+SnVDV4q8Ed2kBIBXsHKfm ekjR4ojYRekmQ83kII7UmW2lnLvQ5xx6uIVfEo+lKiXIQ3sq04ivMm79hytC2lnUlqM7 +j+Iwncm9u2KRkvUjNORdlds3nej3TnpP1kDwppdD8fT6eCP8uwA8LXNdjLhEYtmclwV nsWqCrRoQ4crnEfODVmAyGGnXOVskyPphmSOpurjRuHbMdXps/4/6LjhAba8C2f20hQT a/LQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=9q0u8OoKqU0IDEfezHTEK7fjGbU+KR+mQBFYxc4TTpU=; fh=I+wNhN54JXqsP8tW5AKFfPYq5lqJ5wvTW68JrBsFGdg=; b=qzcY3pxcKWdVvX1voiV87hpb4a8zsQFBRMQOBCIte2XeM9s61AmDXYcui8K3ueNcjq HdxfcodX26PTRoGY8d9/Aojd20k4504i1irTFs/bqmWI9xmKVLHYlDT+jEsU9HCpMjcS 10Wmk0k2mOqenJPeErkRQ5B50NSnFnrWigPFqEbCYgclxshwz/4CqCfCOBUmpEF71fuq a4AbxDPgYQkgGIhHtlrraC1t/il48uIhx0IcbWivhw7NVSjLDVq5AQiVzMkTNfP/b8F7 NLHDt9V0xlCv0NkfmWDllmTmt64X5h49n+SnyXWklQC/w1PS9W0ca3pbMmpDTjYCVOtP 4kmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m+S85SBu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87360-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gl14-20020a170906e0ce00b00a3ec680ee34si789974ejb.469.2024.02.29.11.37.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 11:37:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m+S85SBu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87360-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87360-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C09851F2385F for ; Thu, 29 Feb 2024 19:37:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 977B013C9F5; Thu, 29 Feb 2024 19:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m+S85SBu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AF8E21E499; Thu, 29 Feb 2024 19:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709235428; cv=none; b=X8aW52C4cT/JB60J2/BJWExVMNcSkfWLgtAlsXzrkXnDNvZtbjbmHBdETz5lekIAjZ0jPqXA/c8NWF+A9JgdwfCe5ryadXbmdSz58tR4ojZmrUuyp73KCtpcY0SQ+Vp8mFteLnxk5QYtIt5+BR7tuoTD4zy4mYMvKflxGcKJy4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709235428; c=relaxed/simple; bh=HxFiMEFSmzCFY+WY5P1+X68vvWW5G5DzknMWKq1jjbw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mNVu6xBYlVv9ZSElvwGVX/eRVaoZhpy3zjIa4YGSp5ueZujzHoWNimYi8DpO541AOdEoDNnwRWmnBHr9ub0MBWY508K6l1Xs0pnYTGpMuEdyNKbogWq11O0vRtxE7lh2JnCJowyndI5ECSZZFo/th+lFQihSxT4v2jLwnZbFCNE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m+S85SBu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DEB1C433C7; Thu, 29 Feb 2024 19:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709235428; bh=HxFiMEFSmzCFY+WY5P1+X68vvWW5G5DzknMWKq1jjbw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=m+S85SBuV9SIHhfC9dMLCdurLg+KbyJOT0ZuQcfRPg6/ekbFXqmOI8lKWeVI4g2nw 97JdaKY11cvCmY2VP/uzaRPkip8FiGVFuNfb2B7WSaGBbFwGqTbIHqmJKP0b21mGZN 4rxBo1r7Ey34dexq9zLREL2HMcHe4Y9LQxt2DJ2U3/ZssUisaZIQxCcmngap2fFfQj mdcqq9sN4FjNmHPcmD7BccNs/STrWR/FblQgrW1OklBOKeUZHLOz8/Tvp1JhHgQzKW P86eMmDf0P+7+ExJ6cgkscA1xFkJWipaT9lXxCYew7am+U7hL2APqC9jwgXrIdAAgp TQLDWOn4o/u5A== Date: Thu, 29 Feb 2024 11:37:06 -0800 From: Jakub Kicinski To: Kees Cook Cc: Andy Shevchenko , 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: <20240229113706.42c877a1@kernel.org> In-Reply-To: <202402291059.491B5E03@keescook> 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> <20240228165609.06f5254a@kernel.org> <202402291059.491B5E03@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-Transfer-Encoding: 7bit On Thu, 29 Feb 2024 11:08:58 -0800 Kees Cook wrote: > > And some seem to be cargo-culted from out-of-tree code and are unused :S > > Ah, which can I remove? The one in igc.h does not seem to be referenced by anything in the igc directory. Pretty sure it's unused. > As a further aside, this code: > > struct net_device *dev; > ... > struct net_device *p; > ... > /* ensure 32-byte alignment of whole construct */ > alloc_size += NETDEV_ALIGN - 1; > p = kvzalloc(alloc_size, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL); > ... > dev = PTR_ALIGN(p, NETDEV_ALIGN); > > Really screams for a dynamic-sized (bucketed) kmem_cache_alloc > API. Alignment constraints can be described in a regular kmem_cache > allocator (rather than this open-coded version). I've been intending to > build that for struct msg_msg for a while now, and here's another user. :) TBH I'm not sure why we align it :S NETDEV_ALIGN is 32B so maybe some old cache aligning thing?