Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1989709rbb; Tue, 27 Feb 2024 07:25:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW33m/VRb8rDkdK+KRmcO5MRMJMcnqk2T0vQsbuGodbh7oCz0mdKzaWg1inLQjm6pnUyQmtH7Dt27lkPMkCPsNz/mOHSsTXRYqLSc0NGw== X-Google-Smtp-Source: AGHT+IH02JoaUtSrYYWUuPRjtYciUFaLlinAD9ssf2Z8+sADWIiaspejsqPo5Y+kojdhNbVcqxPm X-Received: by 2002:a05:622a:50d:b0:42e:876d:f633 with SMTP id l13-20020a05622a050d00b0042e876df633mr6471321qtx.53.1709047531593; Tue, 27 Feb 2024 07:25:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709047531; cv=pass; d=google.com; s=arc-20160816; b=jQBAfed4/+egg1PctUhLicfiTW/5x2b2VfRDfl4MpYHvjTLncxe5HDBXZfbv31CCsM izuoD0rU0ankGuSLUvFuDV2yTdvDWDyEPXUKFabL+rV/VqitUpEICE9PxnTFlDJYtbQh 8jfC8BFnSwPK/kBjPAK8oImPJssp8xIp1yvvIGyuTPo8zE8o8qHimSxodGQAUG3psdM2 yYdUtVjTWqwFpY6pEO/iq9kmQON5D5W9QS3TV+lVoMtRDQO9z4I8RA44++HOGO+wR64K ek4RbRlxLNfxtAU9vWtZ5SD6LCyiAea63N/ynJCb5hoS/aaqpcIEAlth4DujcTuTZAFs PXxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:feedback-id:dkim-signature :dkim-signature; bh=vk7zMywue6u8Ewys2yjE1YQdG3Ysi/Bjgx+fg8Jugd8=; fh=QOPJFXu1usm4wtWQ5n6Ala+X5o071YTbI55fXdtGVEQ=; b=WCSuSeq+ubV/o2fmYC89RLH2eNZLrlj9x5JsQyhSakGTKmzDu0/a8Z0NJJt71838oh v5noBdp2rinz0KF5irH2G1ugOAWxW8TeTTZmqizbqMPpiQNNYEjKYPyTmfuz5U1yVgVn h3nijQEMYY1hVicDAJRgY2XisPSr+Q19l3USIm9T7zVI8mp2gVgi+bojMIeCcxbP5rwR FvAymanaVLxvhRuf/A18UNuHKvEY0Kxb/KPa06nrGnJe00Yixlkc3tRxbbn0utyvhEFv 9L0cEEQTU4Ut/0DWxI92UivpHnKOkKvc+oB+TVwTfHwpaTSwuWVT2Wzclf5CGqomTHQ7 B+Zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@animalcreek.com header.s=fm2 header.b="g/OAwn8N"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=auIvCa4B; arc=pass (i=1 spf=pass spfdomain=animalcreek.com dkim=pass dkdomain=animalcreek.com dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-83501-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83501-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 i7-20020ac84887000000b0042e5a313367si7456496qtq.175.2024.02.27.07.25.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:25:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83501-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=pass header.i=@animalcreek.com header.s=fm2 header.b="g/OAwn8N"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=auIvCa4B; arc=pass (i=1 spf=pass spfdomain=animalcreek.com dkim=pass dkdomain=animalcreek.com dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-83501-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83501-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 A24B31C220AC for ; Tue, 27 Feb 2024 15:25:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFF06145345; Tue, 27 Feb 2024 15:25:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=animalcreek.com header.i=@animalcreek.com header.b="g/OAwn8N"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="auIvCa4B" Received: from fhigh7-smtp.messagingengine.com (fhigh7-smtp.messagingengine.com [103.168.172.158]) (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 CAF5E1468E3; Tue, 27 Feb 2024 15:25:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.158 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709047516; cv=none; b=ac5JU3rSX/+bB5OdDuUzjpT6NejdVxejENVtjyxCDbxelFDtkN+yNVY2FIcGaBLzkuN4HUM/abG0JnJ1a8JPpMvUlDXbkGHsqSp8vw5SqYWTJ3P8jncRpxrpZoEzdE77wEPGbEwEye6ynOx5ElYb5CL5MhmasH4e5cNxjIq+KTI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709047516; c=relaxed/simple; bh=/0CX/GTDlI99GNqGRU+WOoXiS5slLjuQQEO7NtWVgFs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JYkfZWaTmzD5vkOlpiAM+AEU39c/zGYLgfMt70HbOIMI++j1IqcVHssB2S+mKbVrGxe+cHg1Q5Wr4hC97gmOlfX9CQ9ddFYmzey14BqY8BIYpQ/S83+xsGX7uehfqxT5KhRrBrYpBwBufN7iuQcfJ8369qFdD1mLBt499DXFbs8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=animalcreek.com; spf=pass smtp.mailfrom=animalcreek.com; dkim=pass (2048-bit key) header.d=animalcreek.com header.i=@animalcreek.com header.b=g/OAwn8N; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=auIvCa4B; arc=none smtp.client-ip=103.168.172.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=animalcreek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=animalcreek.com Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id EC67311400AB; Tue, 27 Feb 2024 10:25:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 27 Feb 2024 10:25:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=animalcreek.com; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1709047513; x= 1709133913; bh=vk7zMywue6u8Ewys2yjE1YQdG3Ysi/Bjgx+fg8Jugd8=; b=g /OAwn8Nnd5m2DeHCOg5TZK3ISBP+1I13sk4tur6CbpG6Zfo4jrTWcFTD287kNrM9 /ImIlcYeneF5cktE0bVwndusGl0UKNDbQkHL8D3580oIe5JkQ5er/jJyODDWNU4E TJVzhKtyfxvhik86j2RGgD/RpPr661K4FfyXnFPs/jxrgLiRAv0deAGBAOPyz/TS 5EwPR/Sji/TG8uaQ8qzS2GB0NXLKPgh6mhK22n73uRUFy6HS9L8n5tBxoYvd+SIz UPbj2DQMMn2LkK0vqJMSd0M5lkjb+LRfQlClFOdLJhQRurMPEkugnLuizbXXRbv6 UcyA5htnWMvFRUxmUEGUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1709047513; x=1709133913; bh=vk7zMywue6u8Ewys2yjE1YQdG3Ys i/Bjgx+fg8Jugd8=; b=auIvCa4Bew62NXoHyKzQ9QD86zcWg4W/ntUvHxa3VrLP swYPAQgJDNxhX57rC6LdlOFs2V/dfZDgruU526I144YNsOm3N/TlVNFKS/OYYuem De+QROOwIaN+UdDeyQXdAUQwM+A0ddkCs3c0lXBV5xRglUyJcAWl0uryg+03EcTS SofGAOpjCVpQiT/SP+V7TxKLJHJFo0GWxIgq6udPpsW8ezVOY/Tb+vZsB3enf/TY DPZCJu3eTjP+7HX0N+27ZL0mrFoJDRPT7EY6P6D+bXXrB+TDGopfp89LDDQDyQnN m+mj0bzwf3iwaUOUusFyqzw8BA+al/TSKQUi7bLPAQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgeehgdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjohesthdtredttddtvdenucfhrhhomhepofgrrhhk ucfirhgvvghruceomhhgrhgvvghrsegrnhhimhgrlhgtrhgvvghkrdgtohhmqeenucggtf frrghtthgvrhhnpeeugfejtefgteegieffjeejtedtveefvefffeegkefhtdehtdfgfeev keegvedvgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmghhrvggvrhesrghnihhmrghltghrvggvkhdrtghomh X-ME-Proxy: Feedback-ID: i9cc843c7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 27 Feb 2024 10:25:12 -0500 (EST) Received: by blue.animalcreek.com (Postfix, from userid 1000) id 9CF18521078; Tue, 27 Feb 2024 08:25:11 -0700 (MST) Date: Tue, 27 Feb 2024 08:25:11 -0700 From: Mark Greer To: Alex Elder Cc: Erick Archer , Vaibhav Agarwal , Mark Greer , Johan Hovold , Alex Elder , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Kees Cook , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] greybus: audio: apbridgea: Remove flexible array from struct audio_apbridgea_hdr Message-ID: References: <20240217154758.7965-1-erick.archer@gmx.com> <02cf87a3-4e92-4f6d-98f6-dfc0e198d462@ieee.org> 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: <02cf87a3-4e92-4f6d-98f6-dfc0e198d462@ieee.org> Organization: Animal Creek Technologies, Inc. On Sat, Feb 17, 2024 at 03:18:59PM -0600, Alex Elder wrote: > On 2/17/24 9:47 AM, Erick Archer wrote: > > When a struct containing a flexible array is included in another struct, > > and there is a member after the struct-with-flex-array, there is a > > possibility of memory overlap. These cases must be audited [1]. See: > > > > struct inner { > > ... > > int flex[]; > > }; > > > > struct outer { > > ... > > struct inner header; > > int overlap; > > ... > > }; > > > > This is the scenario for the "struct audio_apbridgea_hdr" structure > > that is included in the following "struct audio_apbridgea_*_request" > > structures: > > Yeah this was not a very good way to define these header > structures, but I'm glad to hear the flexible array at the > end was never used. I don't know why it was there; maybe > it's an artifact from some other information that got removed. > > If the code compiles with your change, it ought to be fine. > (It compiles for me.) > > It would be good for Vaibhav or Mark to comment though, maybe > they can provide some context. Sorry for the delay guys. The way this was done comes from associated firmware that ran on the APBridge. This goes back a while but I think the packet headers may have been in flux at the time and this was a convenient way to change all of the packets if & when it changed. Anyway, it doesn't seem so convenient now. :) So, yeah, getting rid of it sounds like a good thing to do to me. > I'd like to hear from these others, but otherwise this change > looks good to me. > > Reviewed-by: Alex Elder > > diff --git a/drivers/staging/greybus/audio_apbridgea.h b/drivers/staging/greybus/audio_apbridgea.h > > index efec0f815efd..ab707d310129 100644 > > --- a/drivers/staging/greybus/audio_apbridgea.h > > +++ b/drivers/staging/greybus/audio_apbridgea.h > > @@ -65,7 +65,6 @@ > > struct audio_apbridgea_hdr { > > __u8 type; > > __le16 i2s_port; > > - __u8 data[]; > > } __packed; > > > > struct audio_apbridgea_set_config_request { > > -- > > 2.25.1 Acked-by: Mark Greer