[PATCH] wifi: mt76: Strip whitespace from build ddate

Ping-Ke Shih pkshih at realtek.com
Fri Dec 12 18:57:19 PST 2025


Mario Limonciello (AMD) <superm1 at kernel.org> wrote:
> @@ -3124,8 +3125,11 @@ int mt76_connac2_load_patch(struct mt76_dev *dev, const char *fw_name)
>         }
> 
>         hdr = (const void *)fw->data;
> +       strscpy(build_date, hdr->build_date, sizeof(build_date));
> +       build_date[16] = '\0';

As comment of strscpy(), NULL terminator always presents.

 * Copy the source string @src, or as much of it as fits, into the
 * destination @dst buffer. The behavior is undefined if the string
 * buffers overlap. The destination @dst buffer is always NUL terminated,
 * unless it's zero-sized.

> +       strim(build_date);
>         dev_info(dev->dev, "HW/SW Version: 0x%x, Build Time: %.16s\n",
> -                be32_to_cpu(hdr->hw_sw_ver), hdr->build_date);
> +                be32_to_cpu(hdr->hw_sw_ver), build_date);
> 
>         for (i = 0; i < be32_to_cpu(hdr->desc.n_region); i++) {
>                 struct mt76_connac2_patch_sec *sec;
> --
> 2.43.0
> 




More information about the Linux-mediatek mailing list