From b170bad40dab1a1684d629b37cb65a5281d35bd8 Mon Sep 17 00:00:00 2001 From: Sebastian Ott Date: Tue, 16 Apr 2013 14:17:15 +0200 Subject: 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 Signed-off-by: Sebastian Ott Signed-off-by: Martin Schwidefsky --- arch/s390/pci/pci.c | 8 ++++---- arch/s390/pci/pci_insn.c | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'arch/s390/pci') diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 2b21749..51d16f1 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -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; } diff --git a/arch/s390/pci/pci_insn.c b/arch/s390/pci/pci_insn.c index 4bc32f3..22eeb9d 100644 --- a/arch/s390/pci/pci_insn.c +++ b/arch/s390/pci/pci_insn.c @@ -103,7 +103,9 @@ static inline int __pcilg(u64 *data, u64 req, u64 offset, u8 *status) : "d" (__offset) : "cc"); *status = __req >> 24 & 0xff; - *data = __data; + if (!cc) + *data = __data; + return cc; } -- cgit v1.1