Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1623253lqo; Sat, 18 May 2024 11:06:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVM99YV8jfIdrR9Z7pJmXq/+UP5f2O9PE+r/KrSKUJuxMGU9i72TB+gTUxS0f+K7r/dbpfM9VuNcWzucO1o5eqN/kyf39gUIoJYy9W8wQ== X-Google-Smtp-Source: AGHT+IEwhZ5KAbvX8hofOnPM4ouutxo8Ml1Z6MVIOGuc4Kufb7E0/a5ujjn5P7NIAFhkwpQ5Tk1w X-Received: by 2002:a19:5e1b:0:b0:51d:348b:80bb with SMTP id 2adb3069b0e04-5220fe78cc4mr14457633e87.55.1716055602293; Sat, 18 May 2024 11:06:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716055602; cv=pass; d=google.com; s=arc-20160816; b=i+IXzXJaTa78B/2vymhBeZ1Ig0mESLU+ZaAOMmsvNJ44Imwk2UXgHo6yEsllOrSOac 1pcSa23Xjj4W33qWSDU+mn52Kb58p0dt8h7vxI/DCbFHtDpRQRL65d7dzH1Yl2Wrk7M7 5CJLzwbPI//FHoOJKV5bLul/QpYuxJ6BxmdK/UU0u+E8SRjzLT2IwqbTFgMdJzXhqEbn fuYQTmup1Och93x8v+Z7P4J9/tLM2L6syeU/+ulnShUUl3w2t4yTTr5C5WEi6D0HrcvM WqwnXaCgts/lMKFsPPprOckk2OM2ANt5bCFQHR+kZ/eXwJgb+jtUnRf2MzJco/tIiAMN XAYA== 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=eNjtPFN4gwk8FY4XhBI0pqmWHSzhdefGp6JGYF0RnSc=; fh=nyUqX11hu1/ktmfLqSvgKfEyWtnojOr5+AwGuhnHqt8=; b=IUqM9p2nRxqM5yKGKbQ2KG1/EnsULZX5yC0sDg7WfeQT4Kgb7fh1la4GW2iyWSTISk Npvi3vuTfT5A83ou4zrAjhHLd3C+kaekOG1p2/NRspgpHusHy8emwmZTiJy+kosDWKaZ D+bL0FtEIbQiNdK1t7CqD6P3WVGMKHVdJQV3EvwCa3JtT8Rc5HnSrQ67Q4GrZq/9vIYh TZg+IvlnumsGM0CUASr4lqIsBt8n8A5x/zkz6Ph9FoVuD31tdQZwRYSdbkCaW0aQl5NY XUcIS68sClSahQlmCWoZU68K7a3Odb7l+SkO2WPFu83KBhvilEJatmg2PBcsWhkJBIlI FcVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dypsSydO; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-182924-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182924-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 4fb4d7f45d1cf-57693124802si156331a12.148.2024.05.18.11.06.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 11:06:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182924-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=@chromium.org header.s=google header.b=dypsSydO; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-182924-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182924-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 00E491F21A37 for ; Sat, 18 May 2024 18:06:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D36D050A6C; Sat, 18 May 2024 18:06:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dypsSydO" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83DAE3FE4A for ; Sat, 18 May 2024 18:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716055592; cv=none; b=nn8eW726qDBgk1lR1Dzswblv0ujjSZpiQJMHwBpRReACbWFiGtAV8WF1m+XUbtG6OO05d3iYH+G253fym51hkOpedpT1mgE5gdcYed/AZdl0ZU24KHTtyqvkapA8LopL24T6ruLCC7+ZIqamyrzMwJ+7AaauDmbpPDyllxkBSYQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716055592; c=relaxed/simple; bh=SFtO3a4RKrkjrGHguXWwcDovKIMDazuVdb4cBPkaPTE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uRtW+vkSW1+UlPzWy8dp2n05Zc6QP0ml/Qqe6JuaQ1p0hxuded9El8SOSZHmbFv5/HUBhAIldpZIWTptDkZXbGLMLMAcEoPFy+Q+VQ8lWA1dPPTVOU2pI6BAu9vgluZzhLExVlqfPzvYe05tjGe52EtySKJaQA5bclvovqt9D2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=dypsSydO; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6f4603237e0so838345b3a.0 for ; Sat, 18 May 2024 11:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1716055589; x=1716660389; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eNjtPFN4gwk8FY4XhBI0pqmWHSzhdefGp6JGYF0RnSc=; b=dypsSydO/wW0nk8lSSROpX0nlTLl0hYxzIVWa8PD8KvF6CVya4v2vQHt83QgCCv467 JkY4vrQDAuV7qZqFnkdZ2tV3gi0zz9HT7PvzNoRTUjKMC3PZyvH1KeAyHjebPDfSRxOo z8KZic9m1yBDUulQ1evYi6/Rj9ab2ow+Yxt0s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716055589; x=1716660389; 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 :message-id:reply-to; bh=eNjtPFN4gwk8FY4XhBI0pqmWHSzhdefGp6JGYF0RnSc=; b=Ks6aabzIKc1W8CusM5dpd86U7xRAr+0xXpwXOcLBUomdVVzJtxmGu5RpS4OwA4feue DLc9Nc61wvxIBuOVPyYu9YO9X2qdNQQSdPfp88IH1SwQVf1XqFRQ4P13cEmASwfVcwkg lqIj97LaCKLa40mM0o1eSPiI3/EIrAaIXfbUjIiACgWYAT8xlhz7SCMrR8+nVUWXqlvC cQ3PIFdFNIMUnD+w5wggMWi59fd2QXNMvWR0BX6XuWKeykKS+lhobaIlVMu2qMTwDsug lQ4xlsUt/anSktkUAKmBRJgcsLIg1iEAxOEPr7vxL8NH42J6pwmx2dOlgl0WbHiugCDZ 9nuQ== X-Forwarded-Encrypted: i=1; AJvYcCV5c5nolr8HlHvS6zZV3MMxN7IyNONxKVCeC5g3+p7y70N0DhJnzTVX0Jw1GmYTtVePsLI3CZ4XgyCcCG5rGXowj3SGFVP23nQhHb6e X-Gm-Message-State: AOJu0YyG34ZGeNdMz+o4LotKuhXHizwN2ARmmuRuMRfHqCvt8XfNTKHA yrvRx9MU43PrMB8zc/8d6xBQWlWf4VwByq1bE3cVfOYWU6GJj/Jb2lhKce5ZmQ== X-Received: by 2002:a05:6a00:17a7:b0:6f6:7c56:e989 with SMTP id d2e1a72fcca58-6f69fb7d5d7mr3783518b3a.2.1716055588805; Sat, 18 May 2024 11:06:28 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f67a5ffc54sm5978034b3a.34.2024.05.18.11.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 11:06:28 -0700 (PDT) Date: Sat, 18 May 2024 11:06:27 -0700 From: Kees Cook To: Christophe JAILLET Cc: Sumit Semwal , Gustavo Padovan , Christian =?iso-8859-1?Q?K=F6nig?= , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] dma-buf/fence-array: Add flex array to struct dma_fence_array Message-ID: <202405181106.99C0C03BB@keescook> 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 Sat, May 18, 2024 at 07:47:02PM +0200, Christophe JAILLET wrote: > This is an effort to get rid of all multiplications from allocation > functions in order to prevent integer overflows [1][2]. > > The "struct dma_fence_array" can be refactored to add a flex array in order > to have the "callback structures allocated behind the array" be more > explicit. > > Do so: > - makes the code more readable and safer. > - allows using __counted_by() for additional checks > - avoids some pointer arithmetic in dma_fence_array_enable_signaling() > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1] > Link: https://github.com/KSPP/linux/issues/160 [2] > Signed-off-by: Christophe JAILLET Yes please! :) Reviewed-by: Kees Cook -- Kees Cook