lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB0284E3A@AcuExch.aculab.com>
Date:   Mon, 13 Feb 2017 11:29:45 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Larry Finger' <Larry.Finger@...inger.net>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>
Subject: RE: [PATCH 5/7] staging: r8712u: Fix Sparse endian warning in
 rtl871x_recv.c

From: Larry Finger
> Sent: 11 February 2017 03:30
> Sparse reports the following:
>   CHECK   drivers/staging/rtl8712/rtl871x_recv.c
> drivers/staging/rtl8712/rtl871x_recv.c:657:21: warning: incorrect type in assignment (different base
> types)
> drivers/staging/rtl8712/rtl871x_recv.c:657:21:    expected unsigned short [unsigned] [assigned]
> [usertype] len
> drivers/staging/rtl8712/rtl871x_recv.c:657:21:    got restricted __be16 [usertype] <noident>
> 
> Signed-off-by: Larry Finger <Larry.Finger@...inger.net>
> ---
>  drivers/staging/rtl8712/rtl871x_recv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
> index 147b75b..2ef31a4 100644
> --- a/drivers/staging/rtl8712/rtl871x_recv.c
> +++ b/drivers/staging/rtl8712/rtl871x_recv.c
> @@ -654,8 +654,9 @@ sint r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe)
>  	memcpy(ptr, pattrib->dst, ETH_ALEN);
>  	memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN);
>  	if (!bsnaphdr) {
> -		len = htons(len);
> -		memcpy(ptr + 12, &len, 2);
> +		__be16 be_tmp = htons(len);
> +
> +		memcpy(ptr + 12, &be_tmp, 2);

Just do:
	ptr[12] = len << 8;
	ptr[13] = len;

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ