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: <552daf37-c5eb-6634-7456-3fa39c74ebcb@linaro.org>
Date:   Sun, 14 Nov 2021 23:17:38 +0100
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     Drew Fustini <drew@...gleboard.org>,
        kernel test robot <lkp@...el.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>
Subject: Re: drivers/clocksource/timer-pistachio.c:74:22: warning: variable
 'overflow' set but not used

On 14/11/2021 22:29, Drew Fustini wrote:
> On Fri, Nov 12, 2021 at 07:05:48AM +0800, kernel test robot wrote:
>> Hi Drew,
>>
>> FYI, the error/warning still remains.
>>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   debe436e77c72fcee804fb867f275e6d31aa999c
>> commit: a47d7ef4550d08fb428ea4c3f1a9c71674212208 clocksource/drivers/pistachio: Fix trivial typo
>> date:   7 months ago
>> config: mips-randconfig-r012-20210927 (attached as .config)
>> compiler: mips-linux-gcc (GCC) 11.2.0
>> reproduce (this is a W=1 build):
>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a47d7ef4550d08fb428ea4c3f1a9c71674212208
>>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>>         git fetch --no-tags linus master
>>         git checkout a47d7ef4550d08fb428ea4c3f1a9c71674212208
>>         # save the attached .config to linux build tree
>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=mips 
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@...el.com>
>>
>> All warnings (new ones prefixed by >>):
>>
>>    drivers/clocksource/timer-pistachio.c: In function 'pistachio_clocksource_read_cycles':
>>>> drivers/clocksource/timer-pistachio.c:74:22: warning: variable 'overflow' set but not used [-Wunused-but-set-variable]
>>       74 |         u32 counter, overflow;
>>          |                      ^~~~~~~~
>>
>>
>> vim +/overflow +74 drivers/clocksource/timer-pistachio.c
>>
>>     69	
>>     70	static u64 notrace
>>     71	pistachio_clocksource_read_cycles(struct clocksource *cs)
>>     72	{
>>     73		struct pistachio_clocksource *pcs = to_pistachio_clocksource(cs);
>>   > 74		u32 counter, overflow;
>>     75		unsigned long flags;
>>     76	
>>     77		/*
>>     78		 * The counter value is only refreshed after the overflow value is read.
>>     79		 * And they must be read in strict order, hence raw spin lock added.
>>     80		 */
>>     81	
>>     82		raw_spin_lock_irqsave(&pcs->lock, flags);
>>     83		overflow = gpt_readl(pcs->base, TIMER_CURRENT_OVERFLOW_VALUE, 0);

overflow is set here but then never reused in the function. So a call to
gpt_readl without getting the return value is fine.

The warning is different from 'variable is unused'

> I fail to see how variable 'overflow' set but not used as the return
> value of gpt_readl() is unconditionally assigned to 'overflow'.




-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ