Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1891349lqa; Tue, 30 Apr 2024 02:15:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2xB5Xs5J93Um5UWvT2jW9bZZC4gT12OIljSydANgAcnKcmfN26eeNG/Y3X2rOHNeIyaIcD112QH/cc9nu/YfttzzJx5ssEqFze/KPrg== X-Google-Smtp-Source: AGHT+IELM9b2/x4dfWQwgxRQ9K9bnJzr9Jl2eDzRILcAO3bksPZJ8hM+4JkI5ChYcdpBDXJ4P8zW X-Received: by 2002:ac8:5801:0:b0:439:fd29:3e9 with SMTP id g1-20020ac85801000000b00439fd2903e9mr14736453qtg.27.1714468527745; Tue, 30 Apr 2024 02:15:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714468527; cv=pass; d=google.com; s=arc-20160816; b=SUX6hXR7oi0F1tmmr8QM8UAlKV5W4WcxD98bP8V28EbDYovEdUSlTad3uQPaHsHFpv ylA69N65UKp6A9K8epwl497bNdfBcCaOONcyVC9sXlb+5nbhz867ctN51JWYlS+ECmT5 /a414ckLa4inZVbkML4KHrr3Z61CdlKxVnCVVuw94UIyzIB2yb+BaWDl8qf8YA0l6z+g IVjBBIxAbBlTcp9t7oF+VlbEiBIeXk3K+N6M19npwYauciwn/dVdIix0QjqfUvr9FiKC nBa+LEEMgD7MwW8ZRPjzB0exkk9kOwNGrgFJAhxW5wuUne5lYPKdu6FOO6/GLIDvfhMs RDCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=A5/HDxwcKe1CPVTAY+cgDukpdoaBFZ/fMspZPwQu9PA=; fh=roP8Rq6p8gYlZqJ0jpMIlJ4+IFYIFnyw8I07OVWnqSc=; b=txGJVCJ2rx2LtYuqLmqlMp1EvhvgXfdkjM9vr/vnlRdV4faA18hu1qDhKoDROjrz68 NtdXdyjYhVk07U5lS+7YxzOSnYRS9vsnCbR4FSlNErY9H4uoJs18Ohr/Rheo2anOqmDk 6L40RALWaYERLrahYYwo6YBIlDuuMIoDtE5dRRhC5RLoEYsTqOJl30tRnl3drStPh3CW Q6VIRsGbwIKmO3LkOEPAQfYrfXdtw41TOZAQZP4G/q13irnL8w1ZnU9wlkj3S1LXUkU6 +6l+Qf4KJRGbAM82bgeRHTiCxLOgihrcyk90IQi3cr5OCp+25sgVxzL0aGaZLrGTsdnB SPSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=QezeMGZb; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-163632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163632-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v8-20020a05622a144800b0043c5dd21752si562612qtx.742.2024.04.30.02.15.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 02:15:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=QezeMGZb; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-163632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163632-linux.lists.archive=gmail.com@vger.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 76E8B1C21CFE for ; Tue, 30 Apr 2024 09:15:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3200128370; Tue, 30 Apr 2024 09:15:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="QezeMGZb" Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 B7FCD127B68; Tue, 30 Apr 2024 09:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714468520; cv=none; b=KkXPciJILt7US24TFu7aQ0+ypOcywrkwOKSqpfOiVn+sPdAhaD9UQ02xwvYxfdYSyBz4R8561A1DoTGZcZa3LoKedK02lFOtEKhYxO3bJ6QOdg65wbPAgoI3H5/hgVL5/AjdZgEZVTQC+wQ3hvcjopP988GM9PH96cNsr0URJoY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714468520; c=relaxed/simple; bh=A5/HDxwcKe1CPVTAY+cgDukpdoaBFZ/fMspZPwQu9PA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FBZ1DLx3W9wag4CJlNOIqzbIGoz6/hLFSXX0Oscsse+SJ/wSbahaNNJ7mv+jghissMx10XIvOg9BefSGURHBKkQGEvzSOxy1lMIf/EBs/Tn7KgLQN1Ki6ORbNb93aIcJQe4Cv7Dbvzy/neKu7qvHmxmbpBl0Lbad7TjyepjVVCg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=QezeMGZb; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=A5/HDxwcKe1CPVTAY+cgDukpdoaBFZ/fMspZPwQu9PA=; b=QezeMGZbL/2NWH6nP0/grm30hL jMekjRq2qFRUCFMRCVKslzxjAbg9qKxnPhvTx49CL9iwrEZkwp43xFyQ0hHRqjVecoKP32EYhnlYA F7dLnahlYnkHPvtIlVuNduOC/6DiIs0YE0BNWfCwjHkGa3Iepoi9C6AD95I5r4h1/DGRvLsrycMOj XhG0q9cRd0XBlsKJ/npaieP0mBo/2iId1P1fa5DvQPM2vivUKoCsHcxz4syC9vcHK4oPuzkLS4zf0 Se759pCqFVTnwp1pXJJWiexcYhQ4XC/Lfhh/wVX2XZtGeCfqZ5RPr4C6k/6Bbbi7gZfurl8CVIIxS ne8E90VA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1jZo-0000000Gsl8-2RdT; Tue, 30 Apr 2024 09:15:07 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 3F7AD300684; Tue, 30 Apr 2024 11:15:04 +0200 (CEST) Date: Tue, 30 Apr 2024 11:15:04 +0200 From: Peter Zijlstra To: Erick Archer Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Kees Cook , "Gustavo A. R. Silva" , Justin Stitt , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] perf/ring_buffer: Prefer struct_size over open coded arithmetic Message-ID: <20240430091504.GC40213@noisy.programming.kicks-ass.net> References: 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: On Mon, Apr 29, 2024 at 07:40:58PM +0200, Erick Archer wrote: > This is an effort to get rid of all multiplications from allocation > functions in order to prevent integer overflows [1][2]. So personally I detest struct_size() because I can never remember wtf it does, whereas the code it replaces is simple and straight forward :/