The get_bus_id function takes a location code and then searches /sys/bus/pci/slots/*/phy_location for a slot with the matching location code.  Without this patch the comparison only considers the characters up to the length of the input location which can cause a false match. For example, the following to would match.
The get_bus_id function takes a location code and then searches
/sys/bus/pci/slots/*/phy_location for a slot with the matching location
code.  Without this patch the comparison only considers the characters
up to the length of the input location which can cause a false match.
For example, the following to would match.

Input location: U5877.001.00H4031-P1
False match:    U5877.001.00H4031-P10
                                   ^ Comparison stops here

The length of the input is 23 characters and the first 23 characters
are compared, this leaves off the last '0' on the string to compare and
erroneously returns the wrong bus.

In the case of a PHB remove operation, this can cause the incorrect slot
(and associated devices) to be powered off.

Signed-off-by: Robert Jennings <3915fb8377205924ccc3120e302501c7a259dd7e@linux.vnet.ibm.com>

mdroth/powerpc-utils,tyreld/powerpc-utils,shenki/powerpc-utils,kamalesh-babulal/powerpc-utils,leitao/powerpc-ibm-utils-debian,leitao/powerpc-ibm-utils-debian,kamalesh-babulal/powerpc-utils,kamalesh-babulal/powerpc-utils,tyreld/powerpc-utils,mdroth/powerpc-utils,leitao/powerpc-ibm-utils-debian,mdroth/powerpc-utils,shenki/powerpc-utils,tyreld/powerpc-utils,shenki/powerpc-utils