[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aW-KQbHblIy-MTIu@stanley.mountain>
Date: Tue, 20 Jan 2026 16:59:29 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Minu Jin <s9430939@...er.com>
Cc: gregkh@...uxfoundation.org, andriy.shevchenko@...ux.intel.com,
abrahamadekunle50@...il.com, milospuric856@...il.com,
zxcv2569763104@...il.com, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] staging: rtl8723bs: fix unchecked return value of
skb_copy_bits
On Tue, Jan 20, 2026 at 10:22:41PM +0900, Minu Jin wrote:
> diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> index 21690857fd62..135bc5432be6 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> @@ -603,11 +603,13 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
> s32 UserPriority = 0;
>
> _rtw_open_pktfile(ppktfile->pkt, ppktfile);
> - _rtw_pktfile_read(ppktfile, (unsigned char *)ðerhdr, ETH_HLEN);
> + if (_rtw_pktfile_read(ppktfile, (unsigned char *)ðerhdr, ETH_HLEN) < 0)
> + return;
Eventually we'll want to return an error code here too. Make it easy on
our future selves and do it this way:
ret = _rtw_pktfile_read(ppktfile, (unsigned char *)ðerhdr, ETH_HLEN);
if (ret < 0)
return;
>
> /* get UserPriority from IP hdr */
> if (pattrib->ether_type == 0x0800) {
> - _rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
> + if (_rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr)) < 0)
> + return;
> UserPriority = ip_hdr.tos >> 5;
> }
> pattrib->priority = UserPriority;
> @@ -627,8 +629,12 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
> struct qos_priv *pqospriv = &pmlmepriv->qospriv;
> signed int res = _SUCCESS;
>
> + signed int ret;
Don't put a blank line in the middle of the declaration block. Just do
"int ret;". Everyone knows "int" is signed. Don't follow the local
style when the local style is wrong. Also only use s32 when it's part
of a networking or hardware spec. Just use int. Do people imagine that
we'll change int to be unsigned?
Same comments everywhere.
> +
> _rtw_open_pktfile(pkt, &pktfile);
> - _rtw_pktfile_read(&pktfile, (u8 *)ðerhdr, ETH_HLEN);
> + ret = _rtw_pktfile_read(&pktfile, (u8 *)ðerhdr, ETH_HLEN);
> + if (ret < 0)
> + return ret;
>
> pattrib->ether_type = ntohs(etherhdr.h_proto);
>
[ snip ]
> extern void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
> diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> index 944b9c724b32..5b9b959e23ca 100644
> --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> @@ -21,15 +21,19 @@ void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
> pfile->cur_buffer = pfile->buf_start;
> }
>
> -uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
> +int _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
> {
> - uint len = 0;
> + int ret;
> + int len = 0;
No need to change the type of len any more.
regards,
dan carpenter
Powered by blists - more mailing lists