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]
Date:	Fri, 12 Aug 2016 10:30:34 -0400
From:	Jes Sorensen <Jes.Sorensen@...hat.com>
To:	sunbing <sunbing@...flag-linux.com>
Cc:	Larry.Finger@...inger.net, gregkh@...uxfoundation.org,
	linux-wireless@...r.kernel.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org, sunbing.linux@...il.com
Subject: Re: [PATCH] Staging: rtl8723au: os_intfs: fixed case statement is variable issue

sunbing <sunbing@...flag-linux.com> writes:
> On Aug 11, 2016, at 23:25, Jes Sorensen <Jes.Sorensen@...hat.com> wrote:
>
>> Bing Sun <sunbing@...flag-linux.com> writes:
>>> Fixed sparse parse error:
>>> Expected constant expression in case statement.
>>> 
>>> Signed-off-by: Bing Sun <sunbing@...flag-linux.com>
>>> ---
>>> drivers/staging/rtl8723au/os_dep/os_intfs.c | 11 +++++------
>>> 1 file changed, 5 insertions(+), 6 deletions(-)
>>> 
>>> diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c
>>> index b8848c2..f30d5d2 100644
>>> --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c
>>> +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c
>>> @@ -283,14 +283,13 @@ static u32 rtw_classify8021d(struct sk_buff *skb)
>>> 	 */
>>> 	if (skb->priority >= 256 && skb->priority <= 263)
>>> 		return skb->priority - 256;
>>> -	switch (skb->protocol) {
>>> -	case htons(ETH_P_IP):
>>> +
>>> +	if (skb->protocol == htons(ETH_P_IP)) {
>>> 		dscp = ip_hdr(skb)->tos & 0xfc;
>>> -		break;
>>> -	default:
>>> -		return 0;
>>> +		return dscp >> 5;
>>> 	}
>>> -	return dscp >> 5;
>>> +
>>> +	return 0;
>>> }
>> 
>> Pardon me here, but I find it really hard to see how this change is an
>> improvement over the old code in any shape or form.
>> 
>> Jes
>
> There is no functional improvement. 
> But before this patch, when we do: make C=1 M=drivers/staging/rtl8723au/
> An error output: 
> drivers/staging/rtl8723au//os_dep/os_intfs.c:287:14: error: Expected
> constant expression in case statement
> To avoid sparse parse error, a case statement converts to an if statement.
> So we got this patch.

Hello

I understand this part, but it seems to me we are changing the code due
to a broken test case in sparse. Does the warning go away if you use
__constant_htons() instead of htons()?

Jes

Powered by blists - more mailing lists