lkml.org 
[lkml]   [2019]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH 4/6] staging: rtl8188eu: remove unncessary asignment to cleanup long line
From
Date
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);
> }


\
 
 \ /
  Last update: 2019-01-28 12:55    [W:0.088 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site