Re: [PATCH 4/6] staging: rtl8188eu: remove unncessary asignment to cleanup long line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
>  	}


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux