From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 9C94516FF5C for ; Fri, 26 Apr 2024 17:25:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714152310; cv=none; b=rrG+5oOtKC1pWxIWP0g0jUNyIJUXZdXeo5Ucz2yNgSBHMDtCG+n9waksmT3za6CkNKzyyv3VDsSTgr1mZxQygnCe8w0RCEAhC+leIyL6bPPz7OAkBBPLaT2A99bsWRCauh/0Hrw6aXttdRebVE2eOBEXzWT14gx+oaUZSKXDKsU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714152310; c=relaxed/simple; bh=oPkhpvPbCU1Wv33arOnKXSw2XoCJOquEb8duMbQ4dZ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JCvOojrnKImEp+SNGR9d0BteR06hw4pWKde0jb/Dgiw8FocxDhPY2sdv3TDDaHAMaW3H6PE7fGxzdMU4rCe1Efd2R1Bb2zqEpsF0hZK/KPthUDAAprdbv1ZBPW3x/rbXLwiZ53o+MuoLevgWgrQir27Ejw/bVhTm2DTG2jyq+3g= 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.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bTEsCjWA" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1e4266673bbso21237295ad.2 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=q6N9gkRB5H2zpy9rns8EZ/w5X+nr1pXC1p6x0PuYZSvAIeKqOz7rb3huFX6IDICzzq KOuzPbsGdzAblSmARWf8m0AgsRpnG7fQaiTRVajY+DhmchsdDJb4uXn06TFfEeaQXaLk U4LYB85KLfV3UWUVJ4vTx3eWrBm1AjB7uk3qaCJc7dfCU8p33tK1666h0JBS+R/2Ajg8 xJxDr81va8hskXP000lAd+MAzlVvKQBFrYzYM3sd883LEm3gmVe86q5Luv5F4c8/pC/7 fAfh98lQAUpjQ9P8f8ptgrvFzzepiFeZgcxsEF0+LRJfqXanlw0sVAgbAFkWfPuUNKFD zXMA== X-Forwarded-Encrypted: i=1; AJvYcCVOnFEq4P16xSr6KSw5HYyv/jvVdgVCRoPvatoqXlqW7Ojzif4GKXt4Er0zt/DtzB+zj4ul6/PyjlrR2ZE3DG8eH4ZJ3B8iKa4Qd+l+YpSX X-Gm-Message-State: AOJu0Yx9/g4d7tzcLy59Yf4QjsKmgfrevEhZe/6fknK8zH5eqE8xsMel ZKJyUQE4QxrQfPRzr8JbxGPvSlVXJZlxTEJea3AAl5sh+OeRdNWe7L+RnSG9pQ== X-Google-Smtp-Source: AGHT+IG0E5Z74FVbDWrRnuadfoaxsxXmigsr6NiBRtQVcDuOGGVB5BQLKeI6EmE850Ti68uW3W5ELg== 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-hardening@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