s390/pci: do not read data after failed load
If a pci load instruction fails the content of the register where the data is stored is possibly unchanged. Fix the inline assembly wrapper __pcilg to not return stale data. Additionally fix the callers of this function who access uninitialized variables. Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:

committed by
Martin Schwidefsky

parent
f0bacb7fc4
commit
b170bad40d
@@ -281,11 +281,11 @@ static int zpci_cfg_load(struct zpci_dev *zdev, int offset, u32 *val, u8 len)
|
||||
int rc;
|
||||
|
||||
rc = s390pci_load(&data, req, offset);
|
||||
data = data << ((8 - len) * 8);
|
||||
data = le64_to_cpu(data);
|
||||
if (!rc)
|
||||
if (!rc) {
|
||||
data = data << ((8 - len) * 8);
|
||||
data = le64_to_cpu(data);
|
||||
*val = (u32) data;
|
||||
else
|
||||
} else
|
||||
*val = 0xffffffff;
|
||||
return rc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user