Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp127915lqg; Fri, 26 Apr 2024 10:31:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZZo7AdUolvWcu/4EZO9rM+graxEy2c9sb48aDKGIVUuIWCKJsUPmkNT8yfey65hdgKcyWJgAec5xA1v0hACBfLD6D0p/HXimHsm0Evg== X-Google-Smtp-Source: AGHT+IECBaQLjGn1GSLBjLaVvn+T9pw5F0uPqz4V4/KTUFV02us8T99nEc40btN/oLZ+yRi0uiOB X-Received: by 2002:a17:907:da4:b0:a55:6507:6a35 with SMTP id go36-20020a1709070da400b00a5565076a35mr3055874ejc.49.1714152685851; Fri, 26 Apr 2024 10:31:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714152685; cv=pass; d=google.com; s=arc-20160816; b=JFQxRES1FFqDQqkUqlWNM1J+aBF/TbltgZqJCtImW8lXbQRM/Ubsl14E8RmS5cTwsS Em9XckRtLvNVGSswthTUKL9xIFSie6iUl3Q7B0rScdBjeRBTQkjDGQvhb0DZnBUT5Zdh fObCSyrc/XZqMwaqMS5I+0zKKKR9ASC8PmIc5V/3psa1S4g5vw1hbLSWh8d8bO9Hlgyu OiZM1Kfc0eL5y+O4Ela50DoqFn+9j1CTe1l4fEBS9b7tecDOgRHf8zyzahmxvLhjfZ9E /o/HRSJcaeGqpKevtEeF+rLgVjPSGICcTvWaSvjGm3Ul2pJZ1ouJ59KyabfDQe0MROHn obqQ== 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=eIBGyKq1rfo9Eo8YNJRz2sicy53y3cFznRkoeYMePvs=; fh=sXDsjqcdU/8AfBiypiXIsAvTUtks3llZpg6UHJiqaMU=; b=lA020FSdzID9qQ/wDcznZMtZ+HOebECYYvqS6eLkZro3oEa6996FcVM85FB5UN8YEd jBsKQqbgLWL8ayVFa1d6IIw0tJn7K6HJE/aeOs2NYaD11PoPu1pGHuB6FgDRSkqPjYdQ 8MaPblo53NdE1Fn+AjlSW8Z9k7V6j+Ysj2mWM+kBZmZ4QLXjqfaDF5xTg5B2KmsOKx41 ERvqOHVGbidi3JljjpZTPum1q5qonzI9IXZamjyCTlc8IHRf4k1mhTNPaO2rS97PaW62 qB1yfcFqpXSZe2lFAUQmj7JyIGozhuV1IDHZX74E13I3qIL3zOOiIx3MHJrxkycKlr8e HehQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bTEsCjWA; 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-bluetooth+bounces-4127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4127-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. [147.75.80.249]) by mx.google.com with ESMTPS id gq20-20020a170906e25400b00a5891a0ec55si3479205ejb.1026.2024.04.26.10.31.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 10:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bTEsCjWA; 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-bluetooth+bounces-4127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4127-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 924F31F284ED for ; Fri, 26 Apr 2024 17:31:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C0DF171079; Fri, 26 Apr 2024 17:25:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bTEsCjWA" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 AF08A171064 for ; Fri, 26 Apr 2024 17:25:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714152309; cv=none; b=aVI2GepenOoZ5fE5SvJuclXxu7jRFF3qTBt2UlV+ERMgMUJ7JNRp8XjPyCmaaFu2DgS8yky2x/HLSg8Bosy6bnJ9g7GYzGnY3RGMlXnm3AAfU4KTGWyJgEgxxLTiXz2nKVdVzDs5mkHVIzLeRq3Ns8RfQDnJFKfEKl1ozNrG3II= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714152309; c=relaxed/simple; bh=oPkhpvPbCU1Wv33arOnKXSw2XoCJOquEb8duMbQ4dZ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Oz2V+Ou+DvZhL0rc0MXeI8uKxoCxn3+z8bwfM1iGrf1H2600GUbaf7gc3Q+2d/e90Y/MdMbyDNZJgE9y1+hmR230x0mb7sCseWE9xQSHJD1gsHBLXGCAXJkZLFjMifhbx69rZ4CdfrYr0gvyTNEY5oj9TimnHoSvlRBvUcxaiFc= 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=bTEsCjWA; arc=none smtp.client-ip=209.85.214.169 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-pl1-f169.google.com with SMTP id d9443c01a7336-1e3c3aa8938so16470745ad.1 for ; Fri, 26 Apr 2024 10:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714152308; x=1714757108; 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=eIBGyKq1rfo9Eo8YNJRz2sicy53y3cFznRkoeYMePvs=; b=bTEsCjWA1QAmutxnUZ8MaLRya78f06eH6Qb1Q6vVGAjj5GYFyAGHtmmOs3ZkegOCzt gvAvbwIzEWadzyy+m3B4GYfkLOJy9fjQHQFck4z5R3Y1azt+2dJNbCiiizhNtwy05urZ 4zGWc0duOTjaU2PoDeMtb9c3cgWGu50SDdGUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714152308; x=1714757108; 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=eIBGyKq1rfo9Eo8YNJRz2sicy53y3cFznRkoeYMePvs=; b=IPRrOhZuMEP3wLqNeVYwgHHqH2c06ADjscbGBuYGHxAeu5r22h0fH3/tPAWr/sZ+bQ h2iBGeFAh/V9cc3E2phIIx1QOX4bQcKQ2kMTSp2tf6S72FuC6rUc4DAW28+oc72w++sW b8/ooO+Sdi4ieEMxvUydrnYi/5pVCv56xakcvMj9Jqt+++DQfm3D7zNZ+ebrDqQ1Jt5u fTxzBDh0c93lY78FzNBdSqHlHz1GAs5PxBbhEStK7lJDK9Rqg2A26wLefttMxttdPxcU dkYqViH+CCv38XBFZRBbthQG71aG5C8ZWVe70DqOBtwgfp4qche4uUeX4MIsUIVBC/h6 M3eA== X-Forwarded-Encrypted: i=1; AJvYcCX/Aeg9wh4Kn2WD2Rzv//DE0M0Hxv1OFZwAYc1oxB0gYDK13INQ/fU+dn2uPOYIurNz5xRstsGs/FKCRxZiNTKNQbgsPfjmW/cpc6slxx0P X-Gm-Message-State: AOJu0YyJtK85Irg7tJbdAgeN/Dk0H1kkDPEf+sRGTVEnWxP1w4kiu7mL yGBPcxlv7M08GBC+cFQd2hWI5oWp3GJb4Roqwb9Y6RYymmdhaKHTtEjzkl2rKA== X-Received: by 2002:a17:902:ce84:b0:1e9:5fd6:2b01 with SMTP id f4-20020a170902ce8400b001e95fd62b01mr3798663plg.3.1714152307934; Fri, 26 Apr 2024 10:25:07 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id y1-20020a17090322c100b001e503c555afsm10044542plg.97.2024.04.26.10.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 10:25:07 -0700 (PDT) Date: Fri, 26 Apr 2024 10:25:06 -0700 From: Kees Cook To: "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 Subject: Re: [PATCH v2][next] Bluetooth: hci_conn: Use __counted_by() in struct hci_cp_le_big_create_sync and avoid -Wfamnae warning Message-ID: <202404261024.1F22CC68@keescook> References: Precedence: bulk X-Mailing-List: linux-bluetooth@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 Fri, Apr 26, 2024 at 10:45:17AM -0600, Gustavo A. R. Silva wrote: > 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). > > Also, -Wflex-array-member-not-at-end is coming in GCC-14, and we are > getting ready to enable it globally. > > So, use the `DEFINE_FLEX()` helper for an on-stack definition of > a flexible structure where the size of the flexible-array member > is known at compile-time, and refactor the rest of the code, > accordingly. > > With these changes, fix the following warning: > net/bluetooth/hci_conn.c:2116:50: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] > > Link: https://github.com/KSPP/linux/issues/202 > Signed-off-by: Gustavo A. R. Silva Looks right to me. Yay for DEFINE_FLEX(). :) Reviewed-by: Kees Cook -- Kees Cook