From: Pkshih <pkshih@realtek.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: "kvalo@codeaurora.org" <kvalo@codeaurora.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"Larry.Finger@gmail.com" <Larry.Finger@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] rtw89: Fix crash by loading compressed firmware file
Date: Thu, 11 Nov 2021 02:28:09 +0000 [thread overview]
Message-ID: <68f61525b26f46578a62b2a54d775c17@realtek.com> (raw)
In-Reply-To: <s5h5yt6fxpf.wl-tiwai@suse.de>
> -----Original Message-----
> From: Takashi Iwai <tiwai@suse.de>
> Sent: Friday, November 5, 2021 11:07 PM
> To: Pkshih <pkshih@realtek.com>
> Cc: kvalo@codeaurora.org; linux-wireless@vger.kernel.org; Larry.Finger@gmail.com;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] rtw89: Fix crash by loading compressed firmware file
>
>
> You should put const in the cast in le32_get_bits() invocations, at
> least.
>
> For the le32_replace_bits(), ideally it should be rewritten in some
> better way the compiler can catch. e.g. use an inline function to
> take a void * argument without const,
>
> static inline void RTW89_SET_FWCMD_CXRFK_TYPE(void *cmd, unsigned int val)
> {
> le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(17, 10));
> }
>
> Then the compiler will warn when you pass a const pointer there.
>
I have sent a patchset [1] to do these two things by patch 2 and 3.
>
> BTW, while reading your reply, I noticed that it's an unaligned access
> to a 32bit value, which is another potential breakage on some
> architectures. So the whole stuff has to be rewritten in anyway...
>
We use these macros/inline function on skb->data mostly, and I
suppose skb->data is a 32bit aligned address. Since I don't have
this kind of machine on hand, I would like to defer this work until
I have one.
>
> > The macro SET_FW_HDR_PART_SIZE() is used to set the firmware
> > partition size we are going to download, and it is only used
> > by rtw89_fw_download_hdr(). So, I will set the partition size
> > after copying constant firmware header into skb->data.
>
> Sounds good.
>
Please check if my patch works on your platform.
Thanks you.
[1] https://lore.kernel.org/linux-wireless/20211111021457.13776-1-pkshih@realtek.com/T/#t
--
Ping-Ke
next prev parent reply other threads:[~2021-11-11 2:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 7:17 [PATCH] rtw89: Fix crash by loading compressed firmware file Takashi Iwai
2021-11-05 7:21 ` Takashi Iwai
2021-11-05 8:25 ` Kalle Valo
2021-11-05 8:40 ` Takashi Iwai
2021-11-05 9:03 ` Kalle Valo
2021-11-05 14:28 ` Pkshih
2021-11-05 15:07 ` Takashi Iwai
2021-11-11 2:28 ` Pkshih [this message]
2021-11-11 6:31 ` Takashi Iwai
2021-11-11 13:34 ` Takashi Iwai
2021-11-12 0:38 ` Pkshih
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=68f61525b26f46578a62b2a54d775c17@realtek.com \
--to=pkshih@realtek.com \
--cc=Larry.Finger@gmail.com \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=tiwai@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).