public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Martin Kaiser' <martin@kaiser.cx>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Phillip Potter <phil@philpotter.co.uk>,
	Michael Straube <straube.linux@gmail.com>,
	"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/7] staging: r8188eu: use ieee80211 define for version check
Date: Wed, 23 Mar 2022 14:28:42 +0000	[thread overview]
Message-ID: <3fafd45e349a4bc3aa8db888f08a71d3@AcuMS.aculab.com> (raw)
In-Reply-To: <20220323074859.177425-2-martin@kaiser.cx>

From: Martin Kaiser
> Sent: 23 March 2022 07:49
> 
> Use the IEEE80211_FCTL_VERS define to check the version number
> of a received frame.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  drivers/staging/r8188eu/core/rtw_recv.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> index 8800ea4825ff..524a00345501 100644
> --- a/drivers/staging/r8188eu/core/rtw_recv.c
> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> @@ -1063,7 +1063,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv
>  	struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
>  	u8 *ptr = precv_frame->rx_data;
>  	__le16 fc = *(__le16 *)ptr;

Those two lines are somewhat horrid.
Casts of pointers to integer types have a nasty habit of being bugs.
In any case 'ptr' should probably be 'frame_data'.
If the first two bytes are some kind of 16 bit id, then what follows?
Should this be a 'struct' that defines the frame data layout??

	David

> -	u8  ver = (unsigned char)(*ptr) & 0x3;
>  	struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
> 
>  	if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) {
> @@ -1072,8 +1071,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv
>  			pmlmeext->channel_set[ch_set_idx].rx_count++;
>  	}
> 
> -	/* add version chk */
> -	if (ver != 0)
> +	if ((fc & IEEE80211_FCTL_VERS) != 0)
>  		return _FAIL;
> 
>  	pattrib->to_fr_ds = get_tofr_ds(ptr);
> --
> 2.30.2

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2022-03-23 14:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  7:48 [PATCH 0/7] staging: r8188eu: use ieee80211 helpers for parsing Martin Kaiser
2022-03-23  7:48 ` [PATCH 1/7] staging: r8188eu: use ieee80211 define for version check Martin Kaiser
2022-03-23 14:28   ` David Laight [this message]
2022-03-27 18:19     ` Martin Kaiser
2022-03-23 23:59   ` kernel test robot
2022-03-23  7:48 ` [PATCH 2/7] staging: r8188eu: use ieee80211 helper to read the pwr bit Martin Kaiser
2022-03-23  7:48 ` [PATCH 3/7] staging: r8188eu: use standard mechanisms for control frames Martin Kaiser
2022-03-23  7:48 ` [PATCH 4/7] staging: r8188eu: use standard mechanisms for data frames Martin Kaiser
2022-03-23  7:48 ` [PATCH 5/7] staging: r8188eu: use standard mechanisms for qos " Martin Kaiser
2022-03-23  7:48 ` [PATCH 6/7] staging: r8188eu: remove unused data frame subtypes Martin Kaiser
2022-03-23  7:48 ` [PATCH 7/7] staging: r8188eu: remove unused control " Martin Kaiser
2022-03-27 18:09 ` [PATCH v2 0/9] staging: r8188eu: use ieee80211 helpers for parsing Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 1/9] staging: r8188eu: use ieee80211 define for version check Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 2/9] staging: r8188eu: use ieee80211 helper to read the pwr bit Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 3/9] staging: r8188eu: use standard mechanisms for control frames Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 4/9] staging: r8188eu: use standard mechanisms for data frames Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 5/9] staging: r8188eu: use standard mechanisms for qos " Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 6/9] staging: r8188eu: remove unused data frame subtypes Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 7/9] staging: r8188eu: remove unused control " Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 8/9] staging: r8188eu: use ieee80211 macro for sequence number Martin Kaiser
2022-03-27 18:09   ` [PATCH v2 9/9] staging: r8188eu: use ieee80211 define for fragment number Martin Kaiser

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=3fafd45e349a4bc3aa8db888f08a71d3@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=martin@kaiser.cx \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.com \
    /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