public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jaya Durga <jayad@cdac.in>, gregkh@linuxfoundation.org
Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com,
	driverdev-devel@linuxdriverproject.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] Staging: rtl8712: ieee80211:fixed warning line over 80 characters coding style issue
Date: Mon, 08 May 2017 15:35:01 -0700	[thread overview]
Message-ID: <1494282901.31950.73.camel@perches.com> (raw)
In-Reply-To: <1494271365-32548-1-git-send-email-jayad@cdac.in>

On Tue, 2017-05-09 at 00:52 +0530, Jaya Durga wrote:
> fixed warning line over 80 characters coding style issue
> 
> Signed-off-by: Jaya Durga <jayad@cdac.in>
> ---
>  drivers/staging/rtl8712/ieee80211.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c
> index 42cb46c..a7152df 100644
> --- a/drivers/staging/rtl8712/ieee80211.c
> +++ b/drivers/staging/rtl8712/ieee80211.c
> @@ -222,7 +222,9 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
>  		pbuf = r8712_get_ie(pbuf, _WPA_IE_ID_, &len, limit);
>  		if (pbuf) {
>  			/*check if oui matches...*/
> -			if (memcmp((pbuf + 2), wpa_oui_type, sizeof(wpa_oui_type)))
> +			if (memcmp(
> +				(pbuf + 2), wpa_oui_type,
> +				sizeof(wpa_oui_type)))
>  				goto check_next_ie;
>  			/*check version...*/
>  			memcpy((u8 *)&val16, (pbuf + 6), sizeof(val16));

This is a oddly written function.
Perhaps something like this would be more obvious:

unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
{
	u8 *pbuf = pie;

	while (1) {
		int len;

		pbuf = r8712_get_ie(pbuf, _WPA_IE_ID_, &len, limit);
		if (!pbuf)
			break;
		/* check if oui matches... */
		if (memcmp(pbuf + 2, WPA_OUI_TYPE, sizeof(WPA_OUI_TYPE)) == 0 &&
		    get_unaligned_le16(pbuf + 6) == 0x0001) {
			*wpa_ie_len = *(pbuf + 1);
			return pbuf;
		}
		limit = limit - (pbuf - pie) - 2 - len;
		if (limit <= 0)
			break;
		pbuf += 2 + len;
	}

	*wpa_ie_len = 0;
	return NULL;
}

      reply	other threads:[~2017-05-09 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 19:22 [PATCH 4/4] Staging: rtl8712: ieee80211:fixed warning line over 80 characters coding style issue Jaya Durga
2017-05-08 22:35 ` Joe Perches [this message]

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=1494282901.31950.73.camel@perches.com \
    --to=joe@perches.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jayad@cdac.in \
    --cc=linux-kernel@vger.kernel.org \
    /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