Re: [PATCH v1 net] cfg80211: pmsr: use correct nla_get_uX functions

From: Johannes Berg
Date: Mon May 20 2024 - 07:41:27 EST


Couple of minor comments:

The subject is missing wifi: prefix.

On Mon, 2024-05-20 at 15:33 +0800, Lin Ma wrote:
> The commit 9bb7e0f24e7e ("cfg80211: add peer measurement with FTM
> initiator API") defines four attributes, which are
>
> - `NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP` with NLA_U8 type
> - `NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD` with NLA_U16 type
> - `NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION` with NLA_U8 type
> - `NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES` with NLA_U8 type
>
> However, the consumers of these attributes in `pmsr_parse_ftm` blindly
> all use `nla_get_u32`, which is incorrect. Hence, fix these with correct
> `nla_get_u8` and `nla_get_u16`.

Maybe mention a bit more clearly that the _policy_ actually defines them
with those types, so the users are incorrect, vs. a possible scenario
where the kernel's documentation is just incorrect and we have to keep
the code as-is for userspace to continue to function.

I believe the changes are correct since the policy wants the right types
and then on little-endian platforms it'll all work ...

johannes