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:	Wed, 5 Feb 2014 09:02:53 +0100
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Magnus Damm <magnus.damm@...il.com>
Cc:	linux-pci@...r.kernel.org,
	Linux-sh list <linux-sh@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Valentine <valentine.barshak@...entembedded.com>,
	Simon Horman <horms@...ge.net.au>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Ben Dooks <ben.dooks@...ethink.co.uk>
Subject: Re: [PATCH 01/04] PCI: rcar: Register each instance independently

On Wed, Feb 5, 2014 at 7:52 AM, Magnus Damm <magnus.damm@...il.com> wrote:
> +static int rcar_pci_probe(struct platform_device *pdev)
>  {
>         struct resource *cfg_res, *mem_res;
>         struct rcar_pci_priv *priv;
>         void __iomem *reg;
> +       struct hw_pci hw;
>
>         cfg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         reg = devm_ioremap_resource(&pdev->dev, cfg_res);
> @@ -308,31 +271,26 @@ static int __init rcar_pci_probe(struct
>         priv->reg = reg;
>         priv->dev = &pdev->dev;
>
> -       return rcar_pci_add_controller(priv);
> +       memset(&hw, 0, sizeof(hw));
> +       hw.nr_controllers = 1;
> +       hw.private_data = (void **)&priv;

This raised a red flag: taking the address of a variable on the stack.
I know it's correct, as hw.private_data is an array of pointers copied
by pci_common_init_dev() below.
But perhaps it's a good idea to turn priv into an array with one element,
to make this clearer, and avoid the ugly cast?

> +       hw.map_irq = rcar_pci_map_irq;
> +       hw.ops = &rcar_pci_ops;
> +       hw.setup = rcar_pci_setup;
> +       pci_common_init_dev(&pdev->dev, &hw);
> +       return 0;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
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