From patchwork Wed Jun 19 09:51:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 13703582 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2089.outbound.protection.outlook.com [40.107.8.89]) (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 DEC5980C16 for ; Wed, 19 Jun 2024 09:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718790706; cv=fail; b=pj6brOxp6H2S/SJddG90UwRttHVPcXzClNvMZ1l5Bl6Qso6oSZlzTL//2JfD0bvw08PDcurthXG730p9Yn35rWNlSXQu1XPEwpTY4RDY0R9nMF19eOKAFFgum3Jpx5SslI66joEgbzP7nq8TQJ6E72SndjW7K0UPF6wTLSpZm8Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718790706; c=relaxed/simple; bh=AZhPpj013308BbrA94yrMZ4YHMhE4WUiClzwj1H3YWE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fLvNOZbyglv/ZuYBn1MvDZlbeO5+js1InD5xPQanIinzTwlWemOZMXXJU0Nc6Ca6RURUcfDFRapQvDlGmMWEriWFWY8DhUL2NMCLG2bV7R2w2/tPyVS41fZU/Y9UlaVmcQIr1sDK7mi0vc3+n6pSup1HeqH7cfCjLV1+fxCW5/E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=P96m2lWb; arc=fail smtp.client-ip=40.107.8.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="P96m2lWb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hMiNsh+yRaNvYh51MArkLIKgVNLYL1TiRV4LQxETCV/cdEPxaKrgOpw20Bqfth26SJ/L9NePFFn7y9XLle+vGl0fYYiBgC90CQ3GhMN6fwdRXWYjxMENJo8tTUm2wo/6Ks8A53Pck5DcuQAZErJ7GvyV7f2EBpnjGM/kjofRm4Jq0X4IthG3l0B0q4q0l4rAUZa/8Fa5sZW0xGkyoBTkad4c63p6w5IGmVmMe9H03w5rcXlyrG4TNVU4vhUlAGW0jLnPVFblZPwbGY8nZ1wWsX1d2FRbgyfG6VOsz9/v8V4lktBEFqtXEigWqajwOi6aL5YE8YfIZf4XwQRgvOcx4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EpnQn6TQh8LOqKZk5O4flL3CszyzWlPrdQ/CnmAHRHk=; b=IlmEq6ov/lI3F0U9NcASLIwyHZib05UdmBGviQ2O4EiX3aKJ6Z5Tu2etuLACDqxPW/+wYKjKlE/CrU5lqs1LQLAkZ2Dnfg54FHRhlQBBGsqI3CP47APX1+Jn6tekOmdIg6bvZttHfWopaUaZbUhsyz6VqwB5KRkTNMwa0DcrHl/Y5MtADGv1RUFB9YrAKYrrpi0A/gVZBTp6czvSnXHOq8T+zl+jw9t9nbEg0Ovd96l+JrtOzJ/MOVMFARqHferA0dVQtH5S+KYUMToEHNkE+MqNMmIetMqUcVQqE9isoV2d2GcU5QYjgwENdqy7ENKxqOev/gLYk4KEqdbAk2u/vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EpnQn6TQh8LOqKZk5O4flL3CszyzWlPrdQ/CnmAHRHk=; b=P96m2lWbYiNR8YNWXOpEemRumE0CcVscsXo2WBRDArtMg659T0Cn5FYjKe+BtGcgDEZXzENHbe2xXnUe4chg/CmiYPBM/0IjSdzr+zXbLzMHtcq68E449h539LKbZtb7Nfi3ZHELYDlGjecbMQaNqDLgFBwtZxVS/2su3689Y98= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5389.eurprd04.prod.outlook.com (2603:10a6:803:d8::12) by AM7PR04MB7093.eurprd04.prod.outlook.com (2603:10a6:20b:11d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Wed, 19 Jun 2024 09:51:41 +0000 Received: from VI1PR04MB5389.eurprd04.prod.outlook.com ([fe80::2dc5:1126:ca5b:bf27]) by VI1PR04MB5389.eurprd04.prod.outlook.com ([fe80::2dc5:1126:ca5b:bf27%5]) with mapi id 15.20.7677.030; Wed, 19 Jun 2024 09:51:41 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ v2 1/2] shared/util: Add util_iov_new function Date: Wed, 19 Jun 2024 12:51:18 +0300 Message-Id: <20240619095119.167652-2-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240619095119.167652-1-vlad.pruteanu@nxp.com> References: <20240619095119.167652-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: MI1P293CA0016.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:3::8) To VI1PR04MB5389.eurprd04.prod.outlook.com (2603:10a6:803:d8::12) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5389:EE_|AM7PR04MB7093:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d068702-a27a-4f06-5357-08dc90456bb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|52116011|366013|376011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: J0IRk+nqmrWaZsGZ7LeVsv4KkJjSCoJmGwvdb94uCegh5jwNKDwjEfiFulUoYiTDYJagCkS22G0YHozOqSDem80rsyPQ2l/uqM5Ab46XEDCpd/MNKw9oz3n7godlzTuXVjMwCWZ7Z8kKVZ1z8mFYTfMO7vViXWR8PpMkUdLIUvaH/sJuY1mp5QUOENwWgHJ6XKO1CWYXpdN2QkcoHVA4XzOxOgz7n1MC4y/JYlzF5SoSQDYSuvP1goq23MV9nI+C35MroViBw0MbgIrfq9yyeCgFfe0og7vucQqcvbPYwL48WrQozVmvrzomEeAbFSLJRLJxuEd3++6+JAUqdU8OdJFR4k87BJQXoJ/E5CEGHCDve5PXtLlj5pXtKoFS/wCHH4Fb/Te0GHMAfpnTAEsfQ1n3TtHavxY0yuNHSgM/ng6MAC7oUuftNcw3m/NpBXbMpzTM9AcX0SdwZoHbX1gnPBxpw0Rz7RxNu8H2S7ausDKC41I9fVS3uOsqWdBRu8oRtSRGfTFqVKMmo6BYzeLxndd1eixzbBdulIcvay4mZpOxxlVZXAQNWpEBsv0WZh4lqIKyREwgpkMKW0bUvQm3f9+CxzVTdC7IOxUTEkEfzD0wwqVGxHCUkF8b2VlnHw/KBuSaqnJVCDBJ32r831RCGcopy0mtRluQ9l4VGan+Fxp5vh7jo1nwNlLMa2ZV5RUVdhpwA+b2IWkIlOVEVZh5K5tkbQghTBa3VB0nHHnhKg2prkksxi4FAdiiymjJRm0oYuuxhwmHTZvRUIHvD/RL2nFEbaEZkI7H7CesdEg3aw7wjXRh9k+kj8IgzPhrgv3d+w1i4T8ETWXs1opr9yG4rIozVGvHcmiSyYzsR5KnITAT4Ojsg/T2Il007aedNwZcdYVJlUy0xlk0sJid4sqBoChHr7Ed6Yig7jBhq8E2k/p8+bs3bJQlxrKn/bcGxHPq34033Tuqh5Tyi4CTsn5IQGtEKyALRZCwRHadeznrJNMwaWOfm1NApsSxOb+uTjFnf4Ffi+jGbvMnM93B2Lf8A1j8NIOxqD5mavGNODp+TaiYVa38UEbyNMuJ3PlaKRNUWaJ9nNefgRNUCQvouXS/SlmEkafffrjwSroc9IMGt1xv0gsFCIU2v6dYMi6A28uYxjdV4iEHjljlvP438ZPhkAmjO37NyG/OBSugKoVMlewC/9mX1s47sk50vrBjlQtfqcJs0UnDnvRGBM4Ir+LnivBHaMx2sA1rrtsQTReKiCIsFPDWlAob3NFrGLm3lCJ36JuFwpbgY1yMsshUNGv/kNZJ6fpOqAg34tBuTRB36L8J++H9yPGYsguy9qO7dhvp3K/+YWP2Iot/3gfSCuz/8tHmdjhPE1tE8WnbP/Xjl20= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5389.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(52116011)(366013)(376011)(1800799021)(38350700011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LfpxvbM7Db7/3BC2DTbvno1IO9zUR9CfqMtRGcLKBE7osoBx3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PTDCW9L3Dm+/MI7dxydy9T0sv+GA+KTK649zkATLZti71cJ96oEeb43rLQ5i3LulSGa3jUidhiuKSgjoGkEnbNgFb9Zr+pZ2vvezuqfgMexCiUEfZmjfj+iGPwQOzAc+PVcErEXLkijZjk9o8z8bABNBiVrhpC4ejqmuejHZd1RfdH++oEeyq4KZ8A9yHNai6FlnLx23jnZiFUlfnpsUNJtUBReBhQfSd3f6F+y/1Pvwmd6nw8xeZKitiCFSXhKMrSD+r6+1oGuMHjTy+fmaNuWzfiE2Xev9tZwxyFqc3E6P3I4xduDHlTceZWZr1Yry6yV70I8dBhx7o62PZN2Ga6Bu8XCXnWns7TRdor2v+nWX0dKBnDrdUCrVJVbWSXnBPwo4DhTtS7m3qerBsM6LYMUYRSvBm2tsgr3o1U2cpnDAXvHaxJKqDVMk4WYZiYOq0kyRHohlf8TjGlbKa8ssFfBreqZ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d068702-a27a-4f06-5357-08dc90456bb2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5389.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 09:51:41.5451 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nZ8+VKi5/3WfpLTFHZ/y3WjefRrUSjCZH2GnfhCAOwPZeSc3EIZJfS255huklWn+Nkdahb06LwoDrQADQSXhsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7093 This adds the util_iov_new function that allows the user both allocated and set an iovec to the desired value, using only one function call. --- src/shared/util.c | 10 ++++++++++ src/shared/util.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/shared/util.c b/src/shared/util.c index 6a29b5068..30f054a5e 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -542,6 +542,16 @@ void *util_iov_append(struct iovec *iov, const void *data, size_t len) return util_iov_push_mem(iov, len, data); } +struct iovec *util_iov_new(void *data, size_t len) +{ + struct iovec *iov; + + iov = new0(struct iovec, 1); + util_iov_append(iov, data, len); + + return iov; +} + void *util_iov_pull(struct iovec *iov, size_t len) { if (!iov) diff --git a/src/shared/util.h b/src/shared/util.h index bd71577d6..f2ca4f29f 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -176,6 +176,7 @@ void *util_iov_push_le16(struct iovec *iov, uint16_t val); void *util_iov_push_be16(struct iovec *iov, uint16_t val); void *util_iov_push_u8(struct iovec *iov, uint8_t val); void *util_iov_append(struct iovec *iov, const void *data, size_t len); +struct iovec *util_iov_new(void *data, size_t len); void *util_iov_pull(struct iovec *iov, size_t len); void *util_iov_pull_mem(struct iovec *iov, size_t len); void *util_iov_pull_le64(struct iovec *iov, uint64_t *val); From patchwork Wed Jun 19 09:51:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 13703583 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2089.outbound.protection.outlook.com [40.107.8.89]) (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 0299B811FB for ; Wed, 19 Jun 2024 09:51:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718790708; cv=fail; b=fc63p9usnt7wVAfFc/t322ViZXTclGzjxlGk8AO7qzRMnjbqBy2+l+2z7cVRhaLWXKRklS4jFJEbcD8ZYno6VneaXWywfgUMTJ5i/zkBYvAePA1J8cCEDt+jPVBGiP5UDta0bfTEkpxNXsn7jn7eQRHKtiI6kvJ9iCE92lv+uSU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718790708; c=relaxed/simple; bh=yDlmxS09/l5uDb7pfYgZ1rC3RHoOA95XGziZF0zgAdY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=BpyQJf4NMSMEpb0g6uvFFW3qWp8IoWJa8k7tbD1XBX3bqR1z5EqGJD+gvnTWfHXwNa1MJul/GgKMEcx2tAnmOXsNkoWPoh4xDDX+ysWuBk/7DNwhPWTRwe3zYaO9cmonLPkumYog+A1sYq6a9KulrWe3CywQq3G6ZO/YJY76R84= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=hioodjih; arc=fail smtp.client-ip=40.107.8.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="hioodjih" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ROjSvV1qdf5YF1uCzE6a/Q5DzPGAtpnh3oo2hVGYm4I0oTompXDM7lPYc9+NnXBd5ChY8kpuC9DDTUa8llhmqAeq9oq0olOsSUoU5HehhV7twckSLEriuDLty0ZST4Bn8x6awiKL/e78WvxCB8ZHUET77c9u2OyXCktqhl/Wm0GLB4vLir1o5YxjGVPMmqCLkB38eet095OL8JfHSvIf1ox1QqXPYM6nixKUrc8f5LiLEBIiqmQBHSVKgyJha1c1PU7OnB5Ms1WRYAscRM0ks0qdD/R/kgPXzLQro8g6LJV122pPQnQLBYSlhI/KprQAnJ38V0rESuhvY+49U2totg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=orspnGQE3Sxv0lPkv1d/eagWlZEIkXyV3Uodp7BbpVg=; b=QT/+5kYDDBHddCVVZvHcOJWtUA4SpHd/oeFnkfb3BBhQO2OMSiFCoLzzIen3yv9LnIfE1w3xmo0cMR4TvjtfeM6/UVVZSkD2LiDz3L1nfU4Yhf/14SZEZl8WrgdKmUm8NL6RGsz9niHBOrQXCncjcxZN3VkfxdJs4nXX/PwwR6TolufQHSwpfBfJG5KBvXkOSbevHAI9/iR7e8eyNH4a1pPzuOuBuntPDDLDxgOxR0/FEHgARGBjuYxqcIITP64AczGZ7tkldlwVQpzoCLl+8+PWb0HO12bfV44vdWom90tQuth12zDgBSD9ZJMRaCiyZ+/H7i2GHxf/QHjS2po/Bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=orspnGQE3Sxv0lPkv1d/eagWlZEIkXyV3Uodp7BbpVg=; b=hioodjihX0MRq9WhoUgCI2QhNAa6aWd69t619ljcNVA64NMo9iW9MemUBl96H3Uzu7OmP0p+kLKP9A069NIZoY6DjzKW5lENua0jpndHWt19e3ii1t2SGyblnFt2Nw9xz4yQz4yY6l1NG8GTnKY7376tMivjHWLjLQyPvQWFJsQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5389.eurprd04.prod.outlook.com (2603:10a6:803:d8::12) by AM7PR04MB7093.eurprd04.prod.outlook.com (2603:10a6:20b:11d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Wed, 19 Jun 2024 09:51:43 +0000 Received: from VI1PR04MB5389.eurprd04.prod.outlook.com ([fe80::2dc5:1126:ca5b:bf27]) by VI1PR04MB5389.eurprd04.prod.outlook.com ([fe80::2dc5:1126:ca5b:bf27%5]) with mapi id 15.20.7677.030; Wed, 19 Jun 2024 09:51:43 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ v2 2/2] bap: Use util_iov_new when setting bcode Date: Wed, 19 Jun 2024 12:51:19 +0300 Message-Id: <20240619095119.167652-3-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240619095119.167652-1-vlad.pruteanu@nxp.com> References: <20240619095119.167652-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: MI1P293CA0016.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:3::8) To VI1PR04MB5389.eurprd04.prod.outlook.com (2603:10a6:803:d8::12) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5389:EE_|AM7PR04MB7093:EE_ X-MS-Office365-Filtering-Correlation-Id: 25358681-58ce-4370-631a-08dc90456d14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|52116011|366013|376011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: RbaaHSIZj+yDkxSfc0YVSo41RJCZkrP7joWB+21/h3bleD5J9wAXjMNK8GAC7BcswHa0qf8HMFf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MnyTqLAIyHKyuMh8tU14cYHBDmtKR1QM9P9ugupDlG1SR8c14m2Bb8sL3qXg3gL/kB2zc87vk0UFjNuX0IMTi4vWkHMqW8HNBhTRBeXrONdyFXC+aYe1CMDyPgWCORwARLCMHxK/BdbGCBQtc/2MzV6NP9zgjj1kcIyNom9JPpcEUQiYF3kMmLlfECRoPCbEqRC1fYtMxNIeBIAQX9Jh/esZ1xmVfQhwTWlX6rmr2gNcFJN+hlBZg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5389.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(52116011)(366013)(376011)(1800799021)(38350700011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 91M5pmDx/HZT/BY3lG0iHrx9TDgCjFouguS2jj0pdK7seC4huGCLfMYQJNDYwy3MUzUdtBP5EmIKZw+wu+JxzC5IPNJ3+bchBkwVDtD2JUMJwS+L3X5PkSyzX3o/3AHebJe8ge4ADJRNR+7yFEhEDhqZr6bMmlwSlvg4K+GHizHnr3Cl6EhtQMr91pqpHTBHn47YhbFR55bvhIT7VNYy8E2uRp2BJlPkbsIEfI/7lZiifpHOU20r0PntBP9OZzC2Plw3kDoaemsCLhvr++FwYRCx/l2mEEZw58X1FKZh7iaV3xIYOmKq/VidSJFQ/8G1IgVKLQ93jEmM1n7x3RP8DevQoLClCO9etTMUDdgQpZ4DGZQFtnBQBfjngMatdsdKp9Wp829MpO8cSOuHh2DpIdv+77Wt3BNoCtRffZ5gnQCyPR2BM3YJjtitakavxHEpKgmoXnzSRDPFSnpt2fyS4kGfWFB03VaHB65G4+WkF2qdsoCHOJfx8QtFbOpGV0srycpQ4C+vORACBJz5qOXy5LB0UjQZZqgrBOvN8R/49g8GlVeRre49AfIxrG+Rih/4XQ+fAi7IibZdxq5a+75r2D+8Tk0TrdB+tHXn1n39sdsS3NMqVz25D5+xPialeWHSuufr7+Vvv24HD8GT6lKln09zaSe1byf/hhxMsiqwx/FEkVeXYxLsDP2SES5vHBUGvwoQg1SrmzPAcx9TcLimcpsKIvMfnITzvQiVQ0f6FgZaorUriVFIxN+1CEL0ucSre/gFrCznGjMs02Cp9rYGeaqUa9yis9OdwsOAWo/cnyKrEE9bkAY3MLQNLneZYeCjekKENiwLlQ/708w+y5tiJTgTeBZDKSxJvOFdStta+I42j4y80Lih6zr7/+1KoFOYzLKjkbrJzh6mvVc8UCMvV1aml9dNH4RghHahAkV8pwo1tpXji1GyPZ67gJljx8AN5i+YH4yAeCONtXraKnV4Evi6aUyVVO7pq1sW7jPBtk4nUD7Qw1WLlIanblmUTGbnUW1W6iYiww4Rd1kOGAoAAA51Q08QIRp1y+3zWatorctB7iUkxIHoXUg3TAKn4WdMGQK1dXDzLwxfugRFWvlTgqg08i3QLQgxFSXLmKEzbkEqpv8qTymxRmS44+q14/DqYB7ny/t4LN2XWRIZfHpV/zWjr2aijf93T8krRhwLiS2XXK2TFVF0WI7uC6g234CD2a+nHPYCTN3nxu+leK9NRoa3AgV5SDpSXBsC1fjcRXPR7/mwWY9IHvdkxStPZcsK91hJVdFu3TyF1z5NclUqzXAveugRdOL2LVCgFgAfxa7nnEfscm4CQ3y2htCJZrI02BrgOWXATBK4WY6nSdEUt6lPSXq2evrPc4IJB80yarcw9wLWrG1969hG84n+VyvKR5cs7VPqLyrolE0vNfphgleXTQTtsyHWddzip8UL3O19dQcN/MfJa36jLfMUibXh8UfzuAQv510RWUhLkNpFOQ6BtHP05+jf2YhYtps+lcKDVRcgeeFzzeELjxYQnVSNQZg3WWjeDAXgr63+KANHxeXPWXG8dDDLfbapKcN1Mt3tbVR0+MmI9csK8wuMRqRx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25358681-58ce-4370-631a-08dc90456d14 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5389.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 09:51:43.8415 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9JkcKWtUA0bYQKOTxGjSfmGFSN2GntnCZvZ2+5sGWzZmodmD3DVwZmDHZVCf17zWgVl5cby98bQ0OGQVtHu9SA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7093 Currently the broadcast code is set without memory being allocated for it resulting in segmentation fault. This fixes the issue by using the newly created util_iov_new that allocates the memory before setting it. --- profiles/audio/bap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 53e7b3e34..e82a25382 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1042,9 +1042,8 @@ static void create_stream_for_bis(struct bap_data *bap_data, setup->qos.bcast.framing = qos->bcast.framing; setup->qos.bcast.encryption = qos->bcast.encryption; if (setup->qos.bcast.encryption) - util_iov_append(setup->qos.bcast.bcode, - qos->bcast.bcode, - sizeof(qos->bcast.bcode)); + setup->qos.bcast.bcode = util_iov_new(qos->bcast.bcode, + sizeof(qos->bcast.bcode)); setup->qos.bcast.options = qos->bcast.options; setup->qos.bcast.skip = qos->bcast.skip; setup->qos.bcast.sync_timeout = qos->bcast.sync_timeout;