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: <4A5EFC52.7080201@kernel.org>
Date:	Thu, 16 Jul 2009 03:09:22 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	dann frazier <dannf@...com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [x86] pci: Get rid of magic number in AMD bus discovery

dann frazier wrote:
> The number 4 is hardcoded in a couple of loops.
> Use the already-defined PCI_ROOT_NR macro instead.
> 
> Signed-off-by: dann frazier <dannf@...com>
> ---
>  arch/x86/pci/amd_bus.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
> index 3ffa10d..feb3e09 100644
> --- a/arch/x86/pci/amd_bus.c
> +++ b/arch/x86/pci/amd_bus.c
> @@ -332,7 +332,7 @@ static int __init early_fill_mp_bus_info(void)
>  		return 0;
>  
>  	pci_root_num = 0;
> -	for (i = 0; i < 4; i++) {
> +	for (i = 0; i < PCI_ROOT_NR; i++) {
>  		int min_bus;
>  		int max_bus;
>  		reg = read_pci_config(bus, slot, 1, 0xe0 + (i << 2));
> @@ -368,7 +368,7 @@ static int __init early_fill_mp_bus_info(void)
>  	memset(range, 0, sizeof(range));
>  	range[0].end = 0xffff;
>  	/* io port resource */
> -	for (i = 0; i < 4; i++) {
> +	for (i = 0; i < PCI_ROOT_NR; i++) {
>  		reg = read_pci_config(bus, slot, 1, 0xc0 + (i << 3));
>  		if (!(reg & 3))
>  			continue;

please don't do that.

how about
        /* mmio resource */
        for (i = 0; i < 8; i++) {

those value is decided by HW...

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