> From: Jeff Johnson <quic_jjohnson@xxxxxxxxxxx> > Sent: Thursday, August 10, 2023 11:27 AM > To: David Lin <yu-hao.lin@xxxxxxx>; linux-wireless@xxxxxxxxxxxxxxx > Cc: Sharvari Harisangam <sharvari.harisangam@xxxxxxx>; Pete Hsieh > <tsung-hsien.hsieh@xxxxxxx> > Subject: [EXT] Re: [PATCH v3] wifi: mwifiex: added code to support host mlme. > > Caution: This is an external email. Please take care when clicking links or > opening attachments. When in doubt, report the message using the 'Report > this email' button > > > On 8/9/2023 7:39 PM, David Lin wrote: > snip > > > @@ -491,6 +511,17 @@ int mwifiex_cmd_802_11_associate(struct > mwifiex_private *priv, > > sizeof(struct mwifiex_chan_scan_param_set); > > } > > > > + if (priv->adapter->host_mlme) { > > + host_mlme_tlv = (struct mwifiex_ie_types_host_mlme > *)pos; > > + host_mlme_tlv->header.type = > cpu_to_le16(TLV_TYPE_HOST_MLME); > > + host_mlme_tlv->header.len = > > + sizeof(host_mlme_tlv->host_mlme); > > cpu_to_le16(sizeof(host_mlme_tlv->host_mlme)) ?? > > > + host_mlme_tlv->host_mlme = 1; > > + pos += sizeof(host_mlme_tlv->header) + > > + host_mlme_tlv->header.len; > > le16_to_cpu(host_mlme_tlv->header.len) ?? or just use > sizeof(host_mlme_tlv->host_mlme) > > > + host_mlme_tlv->header.len = > > + cpu_to_le16(host_mlme_tlv->header.len); > > The approach currently being taken doesn't look sparse-compliant. You should > write an le16 into a __le16 member; writing a cpu16 into a __le16 member > and then converting in place using cpu_to_le16() is broken. > > > + } > > + > > The above jumped out at me while scanning your patch -- it failed my mental > pattern matching. > Sorry. It is my fault. I did not check the ported code carefully. I think following code should be correct: if (priv->adapter->host_mlme) { host_mlme_tlv = (struct mwifiex_ie_types_host_mlme *)pos; host_mlme_tlv->header.type = cpu_to_le16(TLV_TYPE_HOST_MLME); host_mlme_tlv->header.len = cpu_to_le16(sizeof(host_mlme_tlv->host_mlme)); host_mlme_tlv->host_mlme = 1; pos += sizeof(host_mlme_tlv->header) + sizeof(host_mlme_tlv->host_mlme); } I will fix it in PATCH v4. Thanks. > /jeff