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:	Tue, 21 Feb 2012 11:29:07 -0200
From:	Fabio Estevam <festevam@...il.com>
To:	Michael Thalmeier <michael.thalmeier@...e.at>
Cc:	Matt Mackall <mpm@...enic.com>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	linux-arm-kernel@...ts.infradead.org, michael@...lmeier.at,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i.MX31: mxc-rnga: implement waiting for data in driver

On Tue, Feb 21, 2012 at 10:13 AM, Michael Thalmeier
<michael.thalmeier@...e.at> wrote:

> -static int mxc_rnga_data_present(struct hwrng *rng)
> +static int mxc_rnga_data_present(struct hwrng *rng, int wait)

This looks good, but ...

>  {
> -       int level;
> +       int level, i;
>        void __iomem *rng_base = (void __iomem *)rng->priv;
>
> -       /* how many random numbers is in FIFO? [0-16] */
> -       level = ((__raw_readl(rng_base + RNGA_STATUS) &
> -                       RNGA_STATUS_LEVEL_MASK) >> 8);
> +       for (i = 0; i < 20; i++) {

Why the magic "20" here?

It would be better to add a proper timeout mechanism instead, such as
time_after(jiffies, timeout)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ