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: <a95f8d0d-28ef-7351-cdbb-7da5ad8aa9ad@kernel.org>
Date:   Thu, 5 Nov 2020 10:10:43 +0100
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Lee Jones <lee.jones@...aro.org>
Cc:     linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        paulkf@...rogate.com
Subject: Re: [PATCH 27/36] tty: synclinkmp: Mark never checked 'readval' as
 __always_unused

On 05. 11. 20, 9:43, Lee Jones wrote:
> On Thu, 05 Nov 2020, Jiri Slaby wrote:
> 
>> On 04. 11. 20, 20:35, Lee Jones wrote:
>>> Fixes the following W=1 kernel build warning(s):
>>>
>>>    drivers/tty/synclinkmp.c: In function ‘init_adapter’:
>>>    drivers/tty/synclinkmp.c:5167:6: warning: variable ‘readval’ set but not used [-Wunused-but-set-variable]
>>>
>>> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
>>> Cc: Jiri Slaby <jirislaby@...nel.org>
>>> Cc: paulkf@...rogate.com
>>> Signed-off-by: Lee Jones <lee.jones@...aro.org>
>>> ---
>>>    drivers/tty/synclinkmp.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
>>> index 0ca738f61a35b..75f494bfdcbed 100644
>>> --- a/drivers/tty/synclinkmp.c
>>> +++ b/drivers/tty/synclinkmp.c
>>> @@ -5165,7 +5165,7 @@ static bool init_adapter(SLMP_INFO *info)
>>>    	/* Set BIT30 of Local Control Reg 0x50 to reset SCA */
>>>    	volatile u32 *MiscCtrl = (u32 *)(info->lcr_base + 0x50);
>>> -	u32 readval;
>>> +	u32 __always_unused readval;
>>
>> Why not just remove readval completely as in other cases?
> 
> Because I don't know what the result would be.
> 
> Will the read still happen, or will the compiler optimise it away?

The compiler will eliminate this dead store anyway. However given the 
MiscCtrl pointer is volatile, the read proper must remain.

> My changes should not affect any of the instructions i.e. the register
> read must still take place

I understand. But the C specification helps here.

>> And the loop can be turned into ndelay:
>>
>>          /*
>>           * Force at least 170ns delay before clearing
>>           * reset bit. Each read from LCR takes at least
>>           * 30ns so 10 times for 300ns to be safe.
>>           */
>>          for(i=0;i<10;i++)
>>                  readval = *MiscCtrl;
> 
> Again, since I can't test this, I do not want this patch to contain
> any functional changes.  AFAIC, the 10 register reads must still
> happen after this patch is applied.

OK, let the loop alone. I would bet a half a pig that noone is able to 
test this driver. But one has to write this for someone to raise and 
admit they are still using it. In fact, there are _4_ google replies to 
"Microgate Corporation" "SyncLink Multiport Adapter" "lspci".

thanks,
-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ