Re: [PATCH v3 1/4] iio: proximity: hx9023s: fix assignment order for __counted_by

From: Yasin Lee

Date: Sat Feb 14 2026 - 11:18:51 EST


Hi Andy, Krzysztof,

Thank you both for the review and for the valuable feedback on this series.
Regarding Patch 1, I have refined the commit message to accurately
describe the __counted_by requirement.
If there are no further concerns on this specific fix, may I have your
tags so I can include them in v4?

Thanks again for your time and guidance!

Best regards,
Yasin Lee


On Fri, Feb 13, 2026 at 11:22 PM Yasin Lee <yasin.lee.x@xxxxxxxxx> wrote:
>
> Initialize fw_size before copying firmware data into the flexible
> array member to match the __counted_by() annotation. This fixes the
> incorrect assignment order that triggers runtime safety checks.
>
> Fixes: e9ed97be4fcc ("iio: proximity: hx9023s: Added firmware file parsing functionality")
> Signed-off-by: Yasin Lee <yasin.lee.x@xxxxxxxxx>
> ---
> drivers/iio/proximity/hx9023s.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
> index 2918dfc0df54..ad839db6b326 100644
> --- a/drivers/iio/proximity/hx9023s.c
> +++ b/drivers/iio/proximity/hx9023s.c
> @@ -1034,9 +1034,8 @@ static int hx9023s_send_cfg(const struct firmware *fw, struct hx9023s_data *data
> if (!bin)
> return -ENOMEM;
>
> - memcpy(bin->data, fw->data, fw->size);
> -
> bin->fw_size = fw->size;
> + memcpy(bin->data, fw->data, bin->fw_size);
> bin->fw_ver = bin->data[FW_VER_OFFSET];
> bin->reg_count = get_unaligned_le16(bin->data + FW_REG_CNT_OFFSET);
>
>
> --
> 2.43.0
>