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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 10 Jan 2017 15:43:40 +0100
From:   Joerg Roedel <joro@...tes.org>
To:     Suravee Suthikulpanit <Suravee.Suthikulpanit@....com>
Cc:     linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
        bp@...en8.de, peterz@...radead.org, mingo@...hat.com
Subject: Re: [PATCH v7 2/7] perf/amd/iommu: Modify functions to query max
 banks and counters

On Mon, Jan 09, 2017 at 09:33:42PM -0600, Suthikulpanit, Suravee wrote:
> +static struct amd_iommu *get_amd_iommu(uint idx)
> +{
> +	uint i = 0;
> +	struct amd_iommu *iommu = NULL;
> +
> +	for_each_iommu(iommu) {
> +		if (i == idx)
> +			break;
> +		i++;
> +	}
> +	return iommu;
> +}

Sorry for missing that in the last review, but this function returns
just the last iommu in the list when there are less iommus than the
requested index.

Is that intentional? The following code checks for !iommu, so I guess
not. It should look more like this then:

	static struct amd_iommu *get_amd_iommu(uint idx)
	{
		uint i = 0;
		struct amd_iommu *iommu, *ret = NULL;

		for_each_iommu(iommu)
			if (i++ == idx) {
				ret = iommu;
				break;
			}
		return ret;
	}


Regards,

	Joerg

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ