mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Michael Straube <straube.linux@gmail.com>,
	gregkh@linuxfoundation.org,
	Larry Finger <Larry.Finger@lwfinger.net>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/6] staging: rtl8188eu: remove unncessary asignment to cleanup long line
Date: Mon, 28 Jan 2019 03:54:34 -0800	[thread overview]
Message-ID: <bbf2f5f03f9813f1bbab23ea36c17f38600432e7.camel@perches.com> (raw)
In-Reply-To: <20190128095137.26815-4-straube.linux@gmail.com>

On Mon, 2019-01-28 at 10:51 +0100, Michael Straube wrote:
> Instead of first asign 'wrqu.data.length = p - buff' use 'p - buff'
> directly in min_t() in the subsequent asignment. Clears a line over
> 80 characters checkpatch warning.

Thank you.  I believe you should include Larry Finger
in the cc list for this driver

Using scripts/get_maintainer.pl should tell you that.

And while this is true, another way to reduce line length
is to reduce indentation.

In this function, it is reasonable to change the

	if (authmode == _WPA_IE_ID_) {
		...
	}
}

to

	if (authmode != _WPA_IE_ID_)
		return;
	...
}

Another issue with this code is the sprintf.

It expands a u8 buffer of a maximum of IW_CUSTOM_MAX size
into an allocated buffer of IW_CUSTOM_MAX size with %02x;

That could overflow the allocated buffer.

> diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
[]
> @@ -109,8 +109,7 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
>  			p += sprintf(p, "%02x", sec_ie[i]);
>  		p += sprintf(p, ")");
>  		memset(&wrqu, 0, sizeof(wrqu));
> -		wrqu.data.length = p - buff;
> -		wrqu.data.length = min_t(__u16, wrqu.data.length, IW_CUSTOM_MAX);
> +		wrqu.data.length = min_t(__u16, p - buff, IW_CUSTOM_MAX);
>  		wireless_send_event(adapter->pnetdev, IWEVCUSTOM, &wrqu, buff);
>  		kfree(buff);
>  	}



  reply	other threads:[~2019-01-28 11:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28  9:51 [PATCH 1/6] staging: rtl8188eu: cleanup comments in mlme_linux.c Michael Straube
2019-01-28  9:51 ` [PATCH 2/6] staging: rtl8188eu: remove unnecessary initializations Michael Straube
2019-01-28  9:51 ` [PATCH 3/6] staging: rtl8188eu: cleanup declarations in mlme_linux.c Michael Straube
2019-01-28  9:51 ` [PATCH 4/6] staging: rtl8188eu: remove unncessary asignment to cleanup long line Michael Straube
2019-01-28 11:54   ` Joe Perches [this message]
2019-01-28  9:51 ` [PATCH 5/6] staging: rtl8188eu: &array[0] -> array Michael Straube
2019-01-28  9:51 ` [PATCH 6/6] staging: rtl8188eu: refactor rtw_reset_securitypriv() Michael Straube

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=bbf2f5f03f9813f1bbab23ea36c17f38600432e7.camel@perches.com \
    --to=joe@perches.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®