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: <20150626111047.GA9791@arm.com>
Date:	Fri, 26 Jun 2015 12:10:47 +0100
From:	Will Deacon <will.deacon@....com>
To:	Joerg Roedel <joro@...tes.org>
Cc:	Rob Herring <robh+dt@...nel.org>,
	"grant.likely@...aro.org" <grant.likely@...aro.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Andre Przywara <Andre.Przywara@....com>,
	Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 2/2] arm/smmu: Make use of of_parse_phandle_with_var_args

Hi Joerg,

Thanks for looking at this! I'm fine with the general idea, but obviously
the first patch needs an Ack from a devicetree person.

One comment on the code below...

On Thu, Jun 25, 2015 at 04:52:28PM +0100, Joerg Roedel wrote:
> The function of_parse_phandle_with_args() can only handle 16
> args, but there are systems that require more (25 in my
> case). So use the newly introduced function
> of_parse_phandle_with_var_args() instead.

[...]

> +	masterspec = of_alloc_phandle_args(MAX_MASTER_STREAMIDS);
> +	if (!masterspec)
> +		return -ENOMEM;
> +
>  	i = 0;
>  	smmu->masters = RB_ROOT;
> -	while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters",
> -					   "#stream-id-cells", i,
> -					   &masterspec)) {
> -		err = register_smmu_master(smmu, dev, &masterspec);
> +	while (!of_parse_phandle_with_var_args(dev->of_node, "mmu-masters",
> +					   "#stream-id-cells", i, masterspec,
> +					   MAX_MASTER_STREAMIDS)) {
> +		err = register_smmu_master(smmu, dev, masterspec);
>  		if (err) {
>  			dev_err(dev, "failed to add master %s\n",
> -				masterspec.np->name);
> +				masterspec->np->name);
>  			goto out_put_masters;
>  		}
>  
> @@ -1811,6 +1815,9 @@ out_free_irqs:
>  		free_irq(smmu->irqs[i], smmu);
>  
>  out_put_masters:
> +
> +	of_free_phandle_args(masterspec);

Shouldn't we also free the masterspec on success?

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