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:	Fri, 24 Oct 2014 17:10:51 +0300
From:	Mika Westerberg <mika.westerberg@...ux.intel.com>
To:	"Rafael J. Wysocki" <rjw@...ysocki.net>
Cc:	Lee Jones <lee.jones@...aro.org>,
	Darren Hart <dvhart@...ux.intel.com>,
	Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
	linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ACPI: Use ACPI companion to match only the first
 physical device

On Fri, Oct 24, 2014 at 04:20:41PM +0200, Rafael J. Wysocki wrote:
> > +static bool acpi_companion_match(const struct device *dev)
> > +{
> > +	struct acpi_device *adev;
> > +	bool ret;
> > +
> > +	adev = ACPI_COMPANION(dev);
> > +	if (!adev)
> > +		return false;
> > +
> > +	if (list_empty(&adev->pnp.ids))
> > +		return false;
> > +
> > +	ret = true;
> 
> On a second thought, should we return true if the list of physical devices is
> empty?  That surely means ACPI_COMPANION(dev) lied to us?

I didn't consider that it is even possible but yes, in that case we
should not return true here.

> 
> > +	mutex_lock(&adev->physical_node_lock);
> > +	if (!list_empty(&adev->physical_node_list)) {
> > +		const struct acpi_device_physical_node *node;
> > +
> > +		node = list_first_entry(&adev->physical_node_list,
> > +					struct acpi_device_physical_node, node);
> > +		if (node->dev != dev)
> > +			ret = false;
> 
> And that may be simply
> 
> 		ret = node->dev == dev;

OK.

> > +	}
> > +	mutex_unlock(&adev->physical_node_lock);
> > +
> > +	return ret;
> > +}
> > +
--
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