From: Kalle Valo <kvalo@kernel.org>
To: <Ajay.Kathat@microchip.com>
Cc: <linux-wireless@vger.kernel.org>, <Claudiu.Beznea@microchip.com>,
<Sripad.Balwadgi@microchip.com>, <lkp@intel.com>
Subject: Re: [PATCH 1/8] wifi: wilc1000: fix incorrect type assignment sparse warning
Date: Thu, 13 Oct 2022 09:13:22 +0300 [thread overview]
Message-ID: <874jw8ntdp.fsf@kernel.org> (raw)
In-Reply-To: <2b432ae1-48fc-5a70-0afe-2b9f788f14e4@microchip.com> (Ajay Kathat's message of "Wed, 27 Jul 2022 17:32:03 +0000")
<Ajay.Kathat@microchip.com> writes:
> Hi Kalle,
>
> On 27/07/22 18:30, Kalle Valo wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you
>> know the content is safe
>>
>> <Ajay.Kathat@microchip.com> writes:
>>
>>> From: Ajay Singh <ajay.kathat@microchip.com>
>>>
>>> Sparse reported below warning
>>>>> drivers/net/wireless/microchip/wilc1000/cfg80211.c:361:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int key_mgmt_suite @@ got restricted __be32 [usertype] @@
>>> 'key_mgmt_suite' value is expected in big-endian format. After receiving
>>> mgmt_suite value from wpa_s convert to cpu endianness because the same
>>> value is return back using cfg80211_external_auth_request(). Use
>>> be32_to_cpu() conversion API to avoid the sparse warning.
>>>
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Fixes: c5b331d4f550fb78 ("wifi: wilc1000: add WPA3 SAE support")
>>> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
>>> ---
>>> drivers/net/wireless/microchip/wilc1000/cfg80211.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
>>> index 5c2c7f1dbffd..19862d932f1f 100644
>>> --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
>>> +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
>>> @@ -359,7 +359,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
>>> memcpy(vif->auth.ssid.ssid, sme->ssid, sme->ssid_len);
>>> vif->auth.ssid.ssid_len = sme->ssid_len;
>>> }
>>> - vif->auth.key_mgmt_suite = cpu_to_be32(sme->crypto.akm_suites[0]);
>>> + vif->auth.key_mgmt_suite = be32_to_cpu((__force __be32)sme->crypto.akm_suites[0]);
>> No time to investigate in detail but the cast is just ugly. Isn't there
>> a better way to fix this?
>
>
> I think, there is an another way to handle this issue. 'key_mgmt_suite'
> element in 'cfg80211_external_auth_params' struct should be converted to
> '__be32' type(like below code snippet) because wpa_s expects the value
> in big-endian format . After this change, the type case can be avoided.
> Though I am not sure if these changes can have impact on other driver.
>
>
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index cc8a9880b9d6..92df70afe445 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -3509,7 +3509,7 @@ struct cfg80211_external_auth_params {
> enum nl80211_external_auth_action action;
> u8 bssid[ETH_ALEN] __aligned(2);
> struct cfg80211_ssid ssid;
> - unsigned int key_mgmt_suite;
> + __be32 key_mgmt_suite;
> u16 status;
> const u8 *pmkid;
> };
So just that I understand correctly: struct
cfg80211_crypto_settings::akm_suites is in cpu endian but struct struct
cfg80211_external_auth_params::key_mgmt_suite is in big endian? But your
original patch uses be32_to_cpu() so I must be confused.
It would be good to document this in cfg80211.h, the documentation there
doesn't mention anything about endian.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2022-10-13 6:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 16:03 [PATCH 1/8] wifi: wilc1000: fix incorrect type assignment sparse warning Ajay.Kathat
2022-07-20 16:03 ` [PATCH 2/8] wifi: wilc1000: add WID_TX_POWER WID in g_cfg_byte array Ajay.Kathat
2022-07-27 12:58 ` Kalle Valo
2022-07-20 16:03 ` [PATCH 3/8] wifi: wilc1000: set correct value of 'close' variable in failure case Ajay.Kathat
2022-07-20 16:03 ` [PATCH 4/8] wifi: wilc1000: set station_info flag only when signal value is valid Ajay.Kathat
2022-07-20 16:03 ` [PATCH 5/8] wifi: wilc1000: get correct length of string WID from received config packet Ajay.Kathat
2022-07-20 16:03 ` [PATCH 6/8] wifi: wilc1000: cancel the connect operation during interface down Ajay.Kathat
2022-07-20 16:03 ` [PATCH 7/8] wifi: wilc1000: add 'isinit' flag for SDIO bus similar to SPI Ajay.Kathat
2022-07-20 16:03 ` [PATCH 8/8] wifi: wilc1000: use existing iftype variable to store the interface type Ajay.Kathat
2022-07-27 13:00 ` [PATCH 1/8] wifi: wilc1000: fix incorrect type assignment sparse warning Kalle Valo
2022-07-27 17:32 ` Ajay.Kathat
2022-10-13 6:13 ` Kalle Valo [this message]
2022-10-13 7:39 ` Johannes Berg
2022-10-13 9:40 ` Jouni Malinen
2022-10-13 10:10 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874jw8ntdp.fsf@kernel.org \
--to=kvalo@kernel.org \
--cc=Ajay.Kathat@microchip.com \
--cc=Claudiu.Beznea@microchip.com \
--cc=Sripad.Balwadgi@microchip.com \
--cc=linux-wireless@vger.kernel.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.