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, 26 Jan 2018 10:26:29 -0600
From:   Larry Finger <Larry.Finger@...inger.net>
To:     Jia-Ju Bai <baijiaju1990@...il.com>, zajec5@...il.com,
        hauke@...ke-m.de
Cc:     linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bcma: Replace mdelay with usleep_range in
 bcma_pmu_resources_init

On 01/26/2018 03:13 AM, Jia-Ju Bai wrote:
> After checking all possible call chains to bcma_pmu_resources_init() here,
> my tool finds that this function is never called in atomic context,
> namely never in an interrupt handler or holding a spinlock.
> Thus mdelay can be replaced with usleep_range to avoid busy wait.
> 
> This is found by a static analysis tool named DCNS written by myself.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
> ---
>   drivers/bcma/driver_chipcommon_pmu.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
> index f1eb4d3..478948c 100644
> --- a/drivers/bcma/driver_chipcommon_pmu.c
> +++ b/drivers/bcma/driver_chipcommon_pmu.c
> @@ -203,7 +203,7 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)
>   	 * Add some delay; allow resources to come up and settle.
>   	 * Delay is required for SoC (early init).
>   	 */
> -	mdelay(2);
> +	usleep_range(1500, 2000);

I have no idea how critical this delay might be, but it would be safer to never 
make the sleep be shorter than the original delay. Using (2000, 2500) would be a 
better choice of arguments for usleep_range().

NACK

Larry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ