Received: by 2002:ab2:f03:0:b0:1ef:ffd0:ce49 with SMTP id i3csp72859lqf; Tue, 26 Mar 2024 14:57:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgcbwti0URcE6yGCZVtkcfgYXEUS1AeR7gQZ7h/XQpcVClhwComQQ2K9R/Wq1QGMFWJqONBhm2a2Z3A7Nx+HcHlR8tSRQJBsmSZo4OMQ== X-Google-Smtp-Source: AGHT+IEk/ER88Wr3zlEQG/qhcSNAf0evjnt8jTJ5GLMJHGAc5daaP126ChnPyVFf6VnV9TgInWMc X-Received: by 2002:a05:6214:dc2:b0:696:8806:12a5 with SMTP id 2-20020a0562140dc200b00696880612a5mr13903065qvt.34.1711490264660; Tue, 26 Mar 2024 14:57:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711490264; cv=pass; d=google.com; s=arc-20160816; b=B2IOmrcn5BCEp1dq3ISjGcZrp8Nf2GNCwTee6wD4TZuKe6hYyXfXgCc8le1fEYH75T /3Y6o1GxWFg0Ff0h0lHdGn006XR8S3ddLEkKTwxaE+PkNSvS49Fyc0WNdSsvHW8TNM62 tUbhpuDujGrg6dpZZW79Ki1JoyV3dL0dGbelWMvgj5Zjt6h0mvkZ1YUu3geQp4FEbV3b dJgL0JVUQzmQf8YHZdxpJetDpXagWkW30pXpGN5y5+MEkOVprI0V0W6Sul2pPI1j0YHO eXu7ZF9BUt8QyCAJmLTienJGhUFFZxoA+424HKBXhqLvoMCJio5lKP3rIdyXtT6+jSMF CMig== 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:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=6DCdr4eyAU+kRAslFEtTKuTG/6MkQfr4djJhxLPnJfE=; fh=5tDPSWixbmbCEog7tMpYnfpx+8x1DULZvMKEsPQuW9Y=; b=suCs4KgZc8E5MzEkUMMN6VgVxxoJxw2/VZZoe62kLzqQg+Myrp3dZbjXv96doYFUtM V2ikCyoMpTvMMMu+roxqxRb+WuiGnA/LpptPsIZ5+2Rh+TMibBWrZHs67qaQ2EhBJg42 EH4wdXBw1m5Md1r/6Q6HcDyFBnpRJw3gnjfUT6f22wgOnZDly9dsiiPJb1r9oeg3BYvd GEAUh7o+4pTvA2PtVW2WtQc9yw8k7CD8+1H9K9Nxh1gYjYwmxZ0f0z/dXfF3u6YR/hbx D2jVf6Cpx/VdCMdAaW44KLqCmldl/kIr7Ei+T3WtxcOr3Lw+KCOY5tgKv6Kz6h0MIPh2 qWlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b="COQ/ROch"; arc=pass (i=1 spf=pass spfdomain=embeddedor.com dkim=pass dkdomain=embeddedor.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2806-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2806-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 gu15-20020a056214260f00b00692d62023bcsi10834188qvb.591.2024.03.26.14.57.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 14:57:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-2806-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="COQ/ROch"; arc=pass (i=1 spf=pass spfdomain=embeddedor.com dkim=pass dkdomain=embeddedor.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2806-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2806-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 5506F1C348BC for ; Tue, 26 Mar 2024 21:57:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14D5813D8AE; Tue, 26 Mar 2024 21:57:41 +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="COQ/ROch" X-Original-To: linux-bluetooth@vger.kernel.org Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) (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 5609A13D89C for ; Tue, 26 Mar 2024 21:57:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.89.44.39 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711490260; cv=none; b=bYUtC4HsioHN5lvboFyJ3NRCoDukDQvGfpQvqcSYMC03nYQ8D9grtPUMc9ynozapV26HGVE5IudzY+NK6Bo9ciruTppxgWxf4IuYm72jANYnJKuQVHMAPbTdQKP9cj7+bCfwbiPLBTxkXmMPq2H3gEWEWNWnbKo37iwPK15L4Hk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711490260; c=relaxed/simple; bh=UoR0o32MKIvmAp1ANiKOl+9qFONvSJ8UPsF1pvgXFFI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kclTdtU8x4q0jm7AzOUqMu6rEitsC/XrCGfq8dqCpeHDt3jnhcBe3qO2TGVp34nGXwZBe2ZjTPVkC5byord4b1hSpP0lvOMjUA7dHAfPp1+06rmYWEoFUXi1nx6ohFvf4w0kigzR1OIfoBoLSk5ANh5+dDSbGB2/k44Ca9xbwUI= 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=COQ/ROch; arc=none smtp.client-ip=35.89.44.39 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-6002a.ext.cloudfilter.net ([10.0.30.222]) by cmsmtp with ESMTPS id p9lirSFOePM1hpEnZrlqWd; Tue, 26 Mar 2024 21:57:37 +0000 Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with ESMTPS id pEnZrY089iKqRpEnZrFFfT; Tue, 26 Mar 2024 21:57:37 +0000 X-Authority-Analysis: v=2.4 cv=I9quR8gg c=1 sm=1 tr=0 ts=660344d1 a=1YbLdUo/zbTtOZ3uB5T3HA==:117 a=zXgy4KOrraTBHT4+ULisNA==:17 a=IkcTkHD0fZMA:10 a=K6JAEmCyrfEA:10 a=wYkD_t78qR0A:10 a=VwQbUJbxAAAA:8 a=NEAV23lmAAAA:8 a=XAy_j3ZW5y_KvujfpI8A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=AjGcO6oz07-iQ99wixmX:22 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=6DCdr4eyAU+kRAslFEtTKuTG/6MkQfr4djJhxLPnJfE=; b=COQ/ROchJF4TuJOB4+r/1/QuSH X3OzD9awPFkyrQ3YdmdmMZUF76or3NNG0Wp040P/9fI04rlK20/GlxuBfl0mbcl6Di0xHyB71GDO4 gVJvJyj887HRbN/aQEDqF4JCLh3OvFZ9iFiJMKHN+l1oVxOrbs3GjBpSicTCN/GCkxuDEzuXaP6r+ DQcKou6pkKZOjIYJRgJ3l82MPnaun4TR47SxfStouuA8Hi9S72fh42iy9n4u4bOXc3wvawD9WPOz4 gqC/0IjRMpEDcH6lud0T+GC2PKjGhm4/07xKE8TKTfpojAXOTOwJKVgBJxBH5hhwCYc4tMoLGqwEH wxBnJRBA==; Received: from [201.172.173.147] (port=54206 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 1rpEnY-001gBp-1E; Tue, 26 Mar 2024 16:57:36 -0500 Message-ID: Date: Tue, 26 Mar 2024 15:57:34 -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][next] Bluetooth: L2CAP: Avoid -Wflex-array-member-not-at-end warnings Content-Language: en-US To: Luiz Augusto von Dentz , "Gustavo A. R. Silva" Cc: Marcel Holtmann , Johan Hedberg , "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: From: "Gustavo A. R. Silva" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: 1rpEnY-001gBp-1E X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.15.10]) [201.172.173.147]:54206 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: MS4xfCXJi8Tl0RfkCkEdhaKag+R7L+0+6BH9PZGljetChfXgwXD9MHAriE6sgGFhh9CEWRIUohtSzgypcFUJAlxdFuumDHvEDsry/eTs0Ja89Za3QdfacLhG W+9DHH2V5m+vC/vUSkYQstVM/HWx0ozjeS+Y5r7O3Ew6gau4sBThlPkV8prEtZs14FdS/LU9C0ucYLg1Rx+hgxjxs5qOEEPrbtTdMe8S51KsPttT4QM9je5p On 3/26/24 15:12, Luiz Augusto von Dentz wrote: > Hi Gustavo, > > On Tue, Mar 26, 2024 at 4:02 PM Gustavo A. R. Silva > wrote: >> >> -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting >> ready to enable it globally. >> >> There are currently a couple of objects (`req` and `rsp`), in a couple >> of structures, that contain flexible structures (`struct l2cap_ecred_conn_req` >> and `struct l2cap_ecred_conn_rsp`), for example: >> >> struct l2cap_ecred_rsp_data { >> struct { >> struct l2cap_ecred_conn_rsp rsp; >> __le16 scid[L2CAP_ECRED_MAX_CID]; >> } __packed pdu; >> int count; >> }; >> >> in the struct above, `struct l2cap_ecred_conn_rsp` is a flexible >> structure: >> >> struct l2cap_ecred_conn_rsp { >> __le16 mtu; >> __le16 mps; >> __le16 credits; >> __le16 result; >> __le16 dcid[]; >> }; >> >> So, in order to avoid ending up with a flexible-array member in the >> middle of another structure, we use the `struct_group_tagged()` (and >> `__struct_group()` when the flexible structure is `__packed`) helper >> to separate the flexible array from the rest of the members in the >> flexible structure: >> >> struct l2cap_ecred_conn_rsp { >> struct_group_tagged(l2cap_ecred_conn_rsp_hdr, hdr, >> >> ... the rest of members >> >> ); >> __le16 dcid[]; >> }; > > Wouldn't it be better, more readable at least, to not define the > l2cap_ecred_conn_rsp_hdr inside thought? Instead just do: > > struct_group_tagged(l2cap_ecred_conn_rsp_hdr, hdr, > ... > }; > > struct l2cap_ecred_conn_rsp { > struct l2cap_ecred_conn_rsp_hdr hdr; > __le16 dcid[]; > }; > > Or was this done this way in order to maintain the same fields? Exactly. But I can change it if people consider that's better. > >> With the change described above, we now declare objects of the type of >> the tagged struct, in this example `struct l2cap_ecred_conn_rsp_hdr`, >> without embedding flexible arrays in the middle of other structures: >> >> struct l2cap_ecred_rsp_data { >> struct { >> struct l2cap_ecred_conn_rsp_hdr rsp; >> __le16 scid[L2CAP_ECRED_MAX_CID]; >> } __packed pdu; >> int count; >> }; >> >> Also, when the flexible-array member needs to be accessed, we use >> `container_of()` to retrieve a pointer to the flexible structure. >> >> We also use the `DEFINE_RAW_FLEX()` helper for a couple of on-stack >> definitions of a flexible structure where the size of the flexible-array >> member is known at compile-time. >> >> So, with these changes, fix the following warnings: >> net/bluetooth/l2cap_core.c:1260:45: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] >> net/bluetooth/l2cap_core.c:3740:45: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] >> net/bluetooth/l2cap_core.c:4999:45: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] >> net/bluetooth/l2cap_core.c:7116:47: 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 >> --- >> >> Hi! >> >> I wonder if `struct l2cap_ecred_conn_rsp` should also be `__packed`. >> >> Thanks >> - Gustavo >> >> include/net/bluetooth/l2cap.h | 20 +++++++++------ >> net/bluetooth/l2cap_core.c | 46 ++++++++++++++++------------------- >> 2 files changed, 33 insertions(+), 33 deletions(-) >> >> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h >> index a4278aa618ab..92a143517d83 100644 >> --- a/include/net/bluetooth/l2cap.h >> +++ b/include/net/bluetooth/l2cap.h >> @@ -463,18 +463,22 @@ struct l2cap_le_credits { >> #define L2CAP_ECRED_MAX_CID 5 >> >> struct l2cap_ecred_conn_req { >> - __le16 psm; >> - __le16 mtu; >> - __le16 mps; >> - __le16 credits; >> + __struct_group(l2cap_ecred_conn_req_hdr, hdr, __packed, >> + __le16 psm; >> + __le16 mtu; >> + __le16 mps; >> + __le16 credits; >> + ); >> __le16 scid[]; >> } __packed; >> >> struct l2cap_ecred_conn_rsp { >> - __le16 mtu; >> - __le16 mps; >> - __le16 credits; >> - __le16 result; >> + struct_group_tagged(l2cap_ecred_conn_rsp_hdr, hdr, >> + __le16 mtu; >> + __le16 mps; >> + __le16 credits; >> + __le16 result; >> + ); >> __le16 dcid[]; >> }; >> >> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c >> index 467b242d8be0..bf087eca489e 100644 >> --- a/net/bluetooth/l2cap_core.c >> +++ b/net/bluetooth/l2cap_core.c >> @@ -1257,7 +1257,7 @@ static void l2cap_le_connect(struct l2cap_chan *chan) >> >> struct l2cap_ecred_conn_data { >> struct { >> - struct l2cap_ecred_conn_req req; >> + struct l2cap_ecred_conn_req_hdr req; >> __le16 scid[5]; >> } __packed pdu; > > Can't we just use DEFINE_RAW_FLEX for the pdu field above? No; DEFINE_FLEX() and DEFINE_RAW_FLEX() are for on-stack code only. Thanks -- Gustavo > >> struct l2cap_chan *chan; >> @@ -3737,7 +3737,7 @@ static void l2cap_ecred_list_defer(struct l2cap_chan *chan, void *data) >> >> struct l2cap_ecred_rsp_data { >> struct { >> - struct l2cap_ecred_conn_rsp rsp; >> + struct l2cap_ecred_conn_rsp_hdr rsp; >> __le16 scid[L2CAP_ECRED_MAX_CID]; >> } __packed pdu; > > Ditto. > >> int count; >> @@ -3746,6 +3746,8 @@ struct l2cap_ecred_rsp_data { >> static void l2cap_ecred_rsp_defer(struct l2cap_chan *chan, void *data) >> { >> struct l2cap_ecred_rsp_data *rsp = data; >> + struct l2cap_ecred_conn_rsp *rsp_flex = >> + container_of(&rsp->pdu.rsp, struct l2cap_ecred_conn_rsp, hdr); >> >> if (test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags)) >> return; >> @@ -3755,7 +3757,7 @@ static void l2cap_ecred_rsp_defer(struct l2cap_chan *chan, void *data) >> >> /* Include all channels pending with the same ident */ >> if (!rsp->pdu.rsp.result) >> - rsp->pdu.rsp.dcid[rsp->count++] = cpu_to_le16(chan->scid); >> + rsp_flex->dcid[rsp->count++] = cpu_to_le16(chan->scid); >> else >> l2cap_chan_del(chan, ECONNRESET); >> } >> @@ -4995,10 +4997,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, >> u8 *data) >> { >> struct l2cap_ecred_conn_req *req = (void *) data; >> - struct { >> - struct l2cap_ecred_conn_rsp rsp; >> - __le16 dcid[L2CAP_ECRED_MAX_CID]; >> - } __packed pdu; >> + DEFINE_RAW_FLEX(struct l2cap_ecred_conn_rsp, pdu, dcid, L2CAP_ECRED_MAX_CID); >> struct l2cap_chan *chan, *pchan; >> u16 mtu, mps; >> __le16 psm; >> @@ -5017,7 +5016,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, >> cmd_len -= sizeof(*req); >> num_scid = cmd_len / sizeof(u16); >> >> - if (num_scid > ARRAY_SIZE(pdu.dcid)) { >> + if (num_scid > L2CAP_ECRED_MAX_CID) { >> result = L2CAP_CR_LE_INVALID_PARAMS; >> goto response; >> } >> @@ -5046,7 +5045,7 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, >> >> BT_DBG("psm 0x%2.2x mtu %u mps %u", __le16_to_cpu(psm), mtu, mps); >> >> - memset(&pdu, 0, sizeof(pdu)); >> + memset(pdu, 0, sizeof(*pdu)); >> >> /* Check if we have socket listening on psm */ >> pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, >> @@ -5072,8 +5071,8 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, >> >> BT_DBG("scid[%d] 0x%4.4x", i, scid); >> >> - pdu.dcid[i] = 0x0000; >> - len += sizeof(*pdu.dcid); >> + pdu->dcid[i] = 0x0000; >> + len += sizeof(*pdu->dcid); >> >> /* Check for valid dynamic CID range */ >> if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_LE_DYN_END) { >> @@ -5107,13 +5106,13 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, >> l2cap_ecred_init(chan, __le16_to_cpu(req->credits)); >> >> /* Init response */ >> - if (!pdu.rsp.credits) { >> - pdu.rsp.mtu = cpu_to_le16(chan->imtu); >> - pdu.rsp.mps = cpu_to_le16(chan->mps); >> - pdu.rsp.credits = cpu_to_le16(chan->rx_credits); >> + if (!pdu->credits) { >> + pdu->mtu = cpu_to_le16(chan->imtu); >> + pdu->mps = cpu_to_le16(chan->mps); >> + pdu->credits = cpu_to_le16(chan->rx_credits); >> } >> >> - pdu.dcid[i] = cpu_to_le16(chan->scid); >> + pdu->dcid[i] = cpu_to_le16(chan->scid); >> >> __set_chan_timer(chan, chan->ops->get_sndtimeo(chan)); >> >> @@ -5135,13 +5134,13 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, >> l2cap_chan_put(pchan); >> >> response: >> - pdu.rsp.result = cpu_to_le16(result); >> + pdu->result = cpu_to_le16(result); >> >> if (defer) >> return 0; >> >> l2cap_send_cmd(conn, cmd->ident, L2CAP_ECRED_CONN_RSP, >> - sizeof(pdu.rsp) + len, &pdu); >> + sizeof(*pdu) + len, pdu); >> >> return 0; >> } >> @@ -7112,14 +7111,11 @@ EXPORT_SYMBOL_GPL(l2cap_chan_connect); >> static void l2cap_ecred_reconfigure(struct l2cap_chan *chan) >> { >> struct l2cap_conn *conn = chan->conn; >> - struct { >> - struct l2cap_ecred_reconf_req req; >> - __le16 scid; >> - } pdu; >> + DEFINE_RAW_FLEX(struct l2cap_ecred_reconf_req, pdu, scid, 1); >> >> - pdu.req.mtu = cpu_to_le16(chan->imtu); >> - pdu.req.mps = cpu_to_le16(chan->mps); >> - pdu.scid = cpu_to_le16(chan->scid); >> + pdu->mtu = cpu_to_le16(chan->imtu); >> + pdu->mps = cpu_to_le16(chan->mps); >> + pdu->scid[0] = cpu_to_le16(chan->scid); >> >> chan->ident = l2cap_get_ident(conn); >> >> -- >> 2.34.1 >> > >