Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1589597lqa; Mon, 29 Apr 2024 12:51:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUi3uENRgv70gK1YiiniE8CdkBrtVjmR1Cpp3xuiqypHZwXy6wsz6M6BUJil/TymJGPe3q63Hnv4iMJY5AcF28qO77ay4lgUEknbQFJHg== X-Google-Smtp-Source: AGHT+IE9SQsIpeNITwhbEJ67jzohjOtuo9WslT8yNIu9nqE6iX20UNWEPcFnlnJ1NZ+draqBO9kK X-Received: by 2002:a25:98c4:0:b0:de5:5823:d5b3 with SMTP id m4-20020a2598c4000000b00de55823d5b3mr12296710ybo.26.1714420269907; Mon, 29 Apr 2024 12:51:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714420269; cv=pass; d=google.com; s=arc-20160816; b=KoVdC/whsAuQBpweETkuipqC9tYo7JklYdx4jPm9lQs+7qgGgXY2wdAz1wIuq4CJSo 4x6ekEY78bKDujKTRuU2OblUGqchMmwvSPjHOwYokN9fCD/jv80ci7eKJ8ZZ43B8Zt0j uzTJUTrAwfto7OeWXJxWeTDi3Ch6gH+lbuvw2o1fiaSAG9Ig/ae5LJPRBsQOwlE4hCPn m9Ui4PzqO2wpss1v12S/leAq+59Vi7ZI+RKfqIJOpzPxS3J3xGHKKcC4C4mjRLO/aB01 IGNs4XtjBi8O/7ZL1I419DwDk/D4m4iLhDntyjOqNiM4k7Eqnf3wkYF2UVnRJeorhU++ daBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=2FeBCJhrHyDzm6ziA3QCmTVmkMK5M89ts1JS18ctx0c=; fh=YR/DBAvnQpF/k6Pj0ZsV1FjsSAsYfTd2MVVThUR3tyQ=; b=lGYY1MYaD7OvBQCtlMsKeORy/TOBdvNUDqU/2Jjb26nexaAT4sDM4DP+rLA9lOABvY 8eYEM0q3C5mJgfKtwqsk2iOQ0lre12xkx4KeGQuY1c7qjd4ZYDeRuJ8SQu+NVFX0sQSX bOF6d6NcKdBbc1P3ZlC9GUslxt239qKt6e87RntMR1RTEq9wBYb74P3TMYFSEMmJlByC lcU6jI7qL6qkEYzL6EdEuqtQuxWg0FIAH4WQSahLYmJHImmCeRGOXPTP4yi+FQLuX9RX hWf97DMBA0L8oKhemqzWfrMsH5wFwL67zNUJK6XW+a0FQO5mcg2Ljweu4q/33AFdiBPR 49Pg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=rEuAK03c; arc=pass (i=1 spf=pass spfdomain=embeddedor.com dkim=pass dkdomain=embeddedor.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4165-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 bs11-20020ac86f0b000000b0043a189a5538si15961147qtb.346.2024.04.29.12.51.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 12:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4165-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=fail header.i=@embeddedor.com header.s=default header.b=rEuAK03c; arc=pass (i=1 spf=pass spfdomain=embeddedor.com dkim=pass dkdomain=embeddedor.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4165-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 8BD7A1C21D53 for ; Mon, 29 Apr 2024 19:51:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6053B130E36; Mon, 29 Apr 2024 19:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=embeddedor.com header.i=@embeddedor.com header.b="rEuAK03c" X-Original-To: linux-bluetooth@vger.kernel.org Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) (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 46E931411E1 for ; Mon, 29 Apr 2024 19:50:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.89.44.33 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714420257; cv=none; b=g0yRmAlM5flLiWw09prh69ujRjSqq+9o8waLCeZoJTR+k++FGGKSPeCrhyC3eHPaQ0fpzRnvwKIwDG5lcIrRN7dNQhwda4eMtRNrMRlvWO0/vtBmYIg1SXtxjStQ1kfaygH7AdoN2sq32u4q1zJzdwMI0Hr5e23IVTB6GL0jIW4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714420257; c=relaxed/simple; bh=ajQDmJ0WWFzPXvoP2mmAy+LuxbIewe2/xsExrL6XISQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cDHG7DUmtF8Hxy7fiqUofSdjYR1ziggXt/+dnXHXImiW7IaXJAHD8iZF13gGl5+X8J7TvOCm4xlVGSt/MNdXeMjFG6VPDCmBbiufn6gnqhHEAk8F6VZDshH3PoB6emqOv7UwbMqSN1cCpK5KXn41crVuKUoXhqTO1ZUUyaSD+QE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=embeddedor.com; spf=pass smtp.mailfrom=embeddedor.com; dkim=pass (2048-bit key) header.d=embeddedor.com header.i=@embeddedor.com header.b=rEuAK03c; arc=none smtp.client-ip=35.89.44.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=embeddedor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=embeddedor.com Received: from eig-obgw-5010a.ext.cloudfilter.net ([10.0.29.199]) by cmsmtp with ESMTPS id 1TsqsWvlkFfFD1X1WscZZk; Mon, 29 Apr 2024 19:50:50 +0000 Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with ESMTPS id 1X1VseJmWUjoW1X1VssLC8; Mon, 29 Apr 2024 19:50:49 +0000 X-Authority-Analysis: v=2.4 cv=Btqbw5X5 c=1 sm=1 tr=0 ts=662ffa19 a=1YbLdUo/zbTtOZ3uB5T3HA==:117 a=zXgy4KOrraTBHT4+ULisNA==:17 a=IkcTkHD0fZMA:10 a=raytVjVEu-sA:10 a=wYkD_t78qR0A:10 a=GnIobxVeLkNF-WZzOA8A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2FeBCJhrHyDzm6ziA3QCmTVmkMK5M89ts1JS18ctx0c=; b=rEuAK03cGdyk9JpPDMHFIOHuB3 yaa5QHKXfz1v4NbbnH5VYAiFdRJe8wZGP6b67svjvwC8epGhVqbsYNbo2zDB9C/gnDE7g1wZCuVYu n6ged8xunX4hdg33PLMAOjytXZjcqByYDcHISnCcAG0G/iQp6urAu7YelT5xg803cDDGa0pVWgjxE HHwq4XhBERPYHCHZQyH3liUj3xD0XytWpURKR+PGSrKtSu888+wZIYsa9+IYnhsfr8QQ3FBFeSKq9 W8xWkro+UYkY7lv6P0IEO2tD7pXtKmaFpwPLMeRP9Ay98xo8Rq9lBh/TEv1BXiRia2I59yO2jscy3 pPZdkjXA==; Received: from [201.172.173.147] (port=53420 helo=[192.168.15.10]) by gator4166.hostgator.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96.2) (envelope-from ) id 1s1X1U-003pzP-24; Mon, 29 Apr 2024 14:50:48 -0500 Message-ID: Date: Mon, 29 Apr 2024 13:50:46 -0600 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2][next] Bluetooth: hci_conn, hci_sync: Use __counted_by() in multiple structs and avoid -Wfamnae warnings To: Kees Cook , "Gustavo A. R. Silva" Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <202404291110.6159F7EA5@keescook> Content-Language: en-US From: "Gustavo A. R. Silva" In-Reply-To: <202404291110.6159F7EA5@keescook> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 201.172.173.147 X-Source-L: No X-Exim-ID: 1s1X1U-003pzP-24 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.15.10]) [201.172.173.147]:53420 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 4 X-Org: HG=hgshared;ORG=hostgator; X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfOwxWzzY2/dBe9tWmLOQId0sNAsbcVN/5wjl4fcHLisRiysIP+nYkrv13mWKnZXU7jqSGpVcf1bZu2NpVBJFgItufBIK6sTZlysh/Rhp7PhA3JsSCfJI zCc3YGEDHvjvyF5Zv1kw3Kh9F+KwS0jNshvLUW3/YvbI75KHHOfzYfjJ8z6w95nufdsYdkj+MVXCjJ4wiLJ+7Ryv+sJhp+rG9xHf4prU8QgOKuUUp4xvCmvH >> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h >> index fe23e862921d..c4c6b8810701 100644 >> --- a/include/net/bluetooth/hci.h >> +++ b/include/net/bluetooth/hci.h >> @@ -2026,7 +2026,7 @@ struct hci_cp_le_set_ext_adv_data { >> __u8 operation; >> __u8 frag_pref; >> __u8 length; >> - __u8 data[]; >> + __u8 data[] __counted_by(length); >> } __packed; > > I noticed some of the other structs here aren't flexible arrays, so it > made me go take a look at these ones. I see that the only user of struct > hci_cp_le_set_ext_adv_data uses a fixed-size array: > > struct { > struct hci_cp_le_set_ext_adv_data cp; > u8 data[HCI_MAX_EXT_AD_LENGTH]; > } pdu; > > Let's just change this from a flex array to a fixed-size array? mmh... not sure about this. It would basically mean reverting this commit: c9ed0a707730 ("Bluetooth: Fix Set Extended (Scan Response) Data") -- Gustavo