Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3052368lqp; Mon, 25 Mar 2024 18:56:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEwRJkqrZwiT90Yh6k6ALTRNnNa9UUe2SXtoMYjV70RTo1XaLmlkJi82MzBQDlGNkafvxBhrnuifdSctzj3TNnBdLzVI5xxL4KiaprMQ== X-Google-Smtp-Source: AGHT+IH3RpnWLcwq3CccbYHQd+vc9SgDB4odPVa03QqOed//oJiwGFuc1SBD4PdXyomWO+96RN1X X-Received: by 2002:a05:620a:51d2:b0:789:e5b6:824f with SMTP id cx18-20020a05620a51d200b00789e5b6824fmr9203581qkb.53.1711418180544; Mon, 25 Mar 2024 18:56:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711418180; cv=pass; d=google.com; s=arc-20160816; b=z+RlT2TubkbNkuHC08KDxxZgTeAjK3xVU+OrPX/DodYWXOjvs2R3x7Vr0bGYX+sW7H l+ckUtyBn98k1kFHTLSvMtv1QQNM+ErUE14ioY8grxdDgnXIP+rHwME5jaz8fDeMftHI rIzSBBf12SlNMTYrkPWdqCfeg/anfhRZC8j+lTCxZYoc4ldb9gnFSeA23NcrLUtxXOir lWyQXmITK49JmLavi7vDEnMdiGfVx3v6B58yA4w+8DG4k85xp8A+LZ8wSHoNpGVwsJPJ tZTRXPpzoY/iyUn1AmmPG6+AT9rb202omB1zFQdeeHfO0fGYLq8hRP8uX4+XEGla02AS RpWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=suzCvMSYdy+fcdrrKoraelA4yv8uFo8s7tRERC/Q0Wk=; fh=7LSSYcn03g35IxoIheLDWa1qhmDkf1bW+uyzKxrvuIE=; b=Fd4sJ8jxOfuKDs0Yh7VF6bn0Pj4fEP9b9zIBq8iaiRQjiL6ns3zCv3nbt8SDnjpfrl h2/32Ql7qAT950WYiOOC7VfLbODYDkIiJoF91ZMHCRlruzwL0on2EN7EOMq0Y81XVhvi 5mu9mGImQi6gJdTZTJ1mt+l0M8zy9KZWoFT3etKJi4dBTq2aeMvWcpnHdyV4uqvnQF/6 +AlIeCxweYYSEZJL/bQtk5Un3jxDNFKxTjzAqhI36FRCWsZ6OeqJyhEpMD8HUISkObKE LYy7yEOAXW4fY5WMcT2TJB3/0O/NaGousAs8y5iFAsZgwYdj7GlolQWFP12GD3JkSaym dv7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PNLTQWJF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-118273-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w12-20020a05620a094c00b007884e2ac8d8si6887898qkw.428.2024.03.25.18.56.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 18:56:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118273-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=pass header.i=@kernel.org header.s=k20201202 header.b=PNLTQWJF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-118273-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118273-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 46D5F1C38450 for ; Tue, 26 Mar 2024 01:56:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB13748CF2; Tue, 26 Mar 2024 01:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PNLTQWJF" 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 0DDED18AF4; Tue, 26 Mar 2024 01:56:13 +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=1711418174; cv=none; b=S7PMdFh2lSsXRo7b69xWM1rSJgoVYnBYdJkR4ublDnP/4QDStB/L5A+9/OteaDGlzJrkc5fXQICyiFr1eilrHD6ki2qEuGisLSkyOo0zU58FyKMdJHLmxJ/BIUVwnGMSTBy8knvN+iCJwnlF17YnV0AfYFacU+EFI69Thh/pdGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711418174; c=relaxed/simple; bh=iGZ1sN109f31IxTk+YNzxIwHJqGr0BjZR34QePejfYI=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=M3/W1col7fKsBzfJ0ZVxmwV7PYPDgFkaIeYPZXAQ7s0rYAzqDLb6nseAoPggV7nwy+ohhydSM5sZ7WPOHnxtqoVU+3FGVS7lh2p40Wty89tanffGNUGn1wv2dBgAPWeo3JhE4NGKcCvvUsh4Hooub4N9XQTy0ikyXXZO6FjBd84= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PNLTQWJF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02612C433F1; Tue, 26 Mar 2024 01:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711418173; bh=iGZ1sN109f31IxTk+YNzxIwHJqGr0BjZR34QePejfYI=; h=Date:From:To:Cc:Subject:From; b=PNLTQWJFFiL35/jUE6Mm1/bDwDU6OR7LrVQE2t/Hi7I92DvPikyN+iJsGsy4E1Mhd c/hX7mfu0Mh3EBfrZwyXzrq/lgLdJNeZTOL1sxG9Rxf9oK8RiQi/6OkOeTdjMN3CB+ 6Gk+osvGd2hPffDRh4LiLccPhNLFBvcpQLbZuTldKBruYwqkoPDiBuLP0Wq/SUAw2m 1uiOIzT5p8akhHOCMUH82Xcmt2DvjadGZ/DzZnQ8Z47eoef3JWrD/J+nGw9UAcsNzn BdGUuBbDQnGetxNCMQBRhh1oApOoVUPw6OcJHZIlEJt+Gy66A50Fk0oxeHxN7NnJIB lor67tPc7FREg== Date: Mon, 25 Mar 2024 19:56:10 -0600 From: "Gustavo A. R. Silva" To: Takashi Sakamoto Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] firewire: Annotate struct fw_iso_packet with __counted_by() Message-ID: 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 Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). Signed-off-by: Gustavo A. R. Silva --- include/linux/firewire.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/firewire.h b/include/linux/firewire.h index dd9f2d765e68..00abe0e5d602 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -463,7 +463,8 @@ struct fw_iso_packet { u32 tag:2; /* tx: Tag in packet header */ u32 sy:4; /* tx: Sy in packet header */ u32 header_length:8; /* Length of immediate header */ - u32 header[]; /* tx: Top of 1394 isoch. data_block */ + /* tx: Top of 1394 isoch. data_block */ + u32 header[] __counted_by(header_length); }; #define FW_ISO_CONTEXT_TRANSMIT 0 -- 2.34.1