[Skiboot] [PATCH 1/2] libflash/blocklevel: Fix blocklevel read ECC failure return code
Cyril Bur
cyril.bur at au1.ibm.com
Mon Aug 24 13:31:16 AEST 2015
If an ECC check fails in blocklevel_read(), the return code from
blocklevel_read() won't be correct.
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
libflash/blocklevel.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libflash/blocklevel.c b/libflash/blocklevel.c
index d9be775..241936f 100644
--- a/libflash/blocklevel.c
+++ b/libflash/blocklevel.c
@@ -82,7 +82,10 @@ int blocklevel_read(struct blocklevel_device *bl, uint32_t pos, void *buf, uint3
if (rc)
goto out;
- rc = memcpy_from_ecc(buf, buffer, len);
+ if (memcpy_from_ecc(buf, buffer, len)) {
+ errno = EBADF;
+ rc = FLASH_ERR_ECC_INVALID;
+ }
out:
free(buffer);
--
2.5.0
More information about the Skiboot
mailing list