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] [day] [month] [year] [list]
Date:	Thu, 1 Oct 2015 22:35:06 -0500
From:	Scott Wood <scottwood@...escale.com>
To:	<igal.liberman@...escale.com>
CC:	<netdev@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>,
	<linux-kernel@...r.kernel.org>, <madalin.bucur@...escale.com>,
	<pebolle@...cali.nl>, <joakim.tjernlund@...nsmode.se>,
	<ppc@...dchasers.com>, <stephen@...workplumber.org>,
	<davem@...emloft.net>
Subject: Re: [v5, 2/6] fsl/fman: Add FMan support

On Thu, Sep 24, 2015 at 12:10:34PM +0300, igal.liberman@...escale.com wrote:
> +int fman_get_rx_extra_headroom(void)
> +{
> +	static bool fm_check_rx_extra_headroom;
> +
> +	if (!fm_check_rx_extra_headroom) {
> +		if (fsl_fm_rx_extra_headroom > FSL_FM_RX_EXTRA_HEADROOM_MAX ||
> +		    fsl_fm_rx_extra_headroom < FSL_FM_RX_EXTRA_HEADROOM_MIN) {
> +			pr_warn("Invalid fsl_fm_rx_extra_headroom value (%d) in bootargs, valid range is %d-%d. Falling back to the default (%d)\n",
> +				fsl_fm_rx_extra_headroom,
> +				FSL_FM_RX_EXTRA_HEADROOM_MIN,
> +				FSL_FM_RX_EXTRA_HEADROOM_MAX,
> +				FSL_FM_RX_EXTRA_HEADROOM);
> +			fsl_fm_rx_extra_headroom = FSL_FM_RX_EXTRA_HEADROOM;
> +		}
> +
> +		fsl_fm_rx_extra_headroom = true;

I think you mean "fm_check_rx_extra_headroom = true".

> +		fsl_fm_rx_extra_headroom = ALIGN(fsl_fm_rx_extra_headroom, 16);
> +	}
> +
> +	return fsl_fm_rx_extra_headroom;
> +}
> +EXPORT_SYMBOL(fman_get_rx_extra_headroom);

Please just check things like this once during module init. 
Init-on-first-use is unnecessarily complicated, and race-prone.

-Scott
--
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