mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-24 18:38:38 +00:00
rtl8712: replace min with min_t
I've changed the ugly casting here and used min_t() instead. I also changed the u16 to a u32 because ->network.Ssid.SsidLength is 32 bits. It doesn't make a difference, but truncating the upper bits away is sloppy. Signed-off-by: Przemo Firszt <przemo@firszt.eu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
87a573ada0
commit
0024a1e734
@ -188,8 +188,7 @@ static inline char *translate_scan(struct _adapter *padapter,
|
|||||||
/* Add the ESSID */
|
/* Add the ESSID */
|
||||||
iwe.cmd = SIOCGIWESSID;
|
iwe.cmd = SIOCGIWESSID;
|
||||||
iwe.u.data.flags = 1;
|
iwe.u.data.flags = 1;
|
||||||
iwe.u.data.length = (u16)min((u16)pnetwork->network.Ssid.SsidLength,
|
iwe.u.data.length = min_t(u32, pnetwork->network.Ssid.SsidLength, 32);
|
||||||
(u16)32);
|
|
||||||
start = iwe_stream_add_point(info, start, stop, &iwe,
|
start = iwe_stream_add_point(info, start, stop, &iwe,
|
||||||
pnetwork->network.Ssid.Ssid);
|
pnetwork->network.Ssid.Ssid);
|
||||||
/* parsing HT_CAP_IE */
|
/* parsing HT_CAP_IE */
|
||||||
@ -1194,8 +1193,7 @@ static int r8711_wx_set_scan(struct net_device *dev,
|
|||||||
if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
|
if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
|
||||||
struct ndis_802_11_ssid ssid;
|
struct ndis_802_11_ssid ssid;
|
||||||
unsigned long irqL;
|
unsigned long irqL;
|
||||||
u32 len = (u32) min((u8)req->essid_len,
|
u32 len = min_t(u8, req->essid_len, IW_ESSID_MAX_SIZE);
|
||||||
(u8)IW_ESSID_MAX_SIZE);
|
|
||||||
memset((unsigned char *)&ssid, 0,
|
memset((unsigned char *)&ssid, 0,
|
||||||
sizeof(struct ndis_802_11_ssid));
|
sizeof(struct ndis_802_11_ssid));
|
||||||
memcpy(ssid.Ssid, req->essid, len);
|
memcpy(ssid.Ssid, req->essid, len);
|
||||||
|
Loading…
Reference in New Issue
Block a user