aboutsummaryrefslogtreecommitdiff
path: root/hw/xive.c
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-08-03 16:45:50 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-15 16:37:14 +1000
commitb3dd496c9422e38d49bc142cd52ad1a04ec20b52 (patch)
treead8586a542de8063a939c14d930dcbe679340416 /hw/xive.c
parent4a8ed09e6e44b5aafbe0b6fdf8cec5bbdbc2ea40 (diff)
downloadskiboot-b3dd496c9422e38d49bc142cd52ad1a04ec20b52.zip
skiboot-b3dd496c9422e38d49bc142cd52ad1a04ec20b52.tar.gz
skiboot-b3dd496c9422e38d49bc142cd52ad1a04ec20b52.tar.bz2
hw/xive: Check return value from xive_decode_vp() (CID 142343 142344)
While it is likely that a failure of xive_decode_vp() would simply trip an error condition later on, it makes sense to check for errors earlier and print a (hopefully) more relevant error message. Fixes: CID 142343 and 142344 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/xive.c')
-rw-r--r--hw/xive.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/xive.c b/hw/xive.c
index 69cd413..d56faed 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -4226,7 +4226,10 @@ static int64_t opal_xive_free_vp_block(uint64_t vp_base)
struct xive *x;
struct xive_vp *vp;
- xive_decode_vp(vp_id, &blk, &idx, NULL, NULL);
+ if (!xive_decode_vp(vp_id, &blk, &idx, NULL, NULL)) {
+ prerror("XIVE: Couldn't decode VP id %u\n", vp_id);
+ return OPAL_INTERNAL_ERROR;
+ }
x = xive_from_pc_blk(blk);
if (!x) {
prerror("XIVE: Instance not found for deallocated VP"
@@ -4293,7 +4296,10 @@ static int64_t opal_xive_alloc_vp_block(uint32_t alloc_order)
struct xive *x;
struct xive_vp *vp;
- xive_decode_vp(vp_id, &blk, &idx, NULL, NULL);
+ if (!xive_decode_vp(vp_id, &blk, &idx, NULL, NULL)) {
+ prerror("XIVE: Couldn't decode VP id %u\n", vp_id);
+ return OPAL_INTERNAL_ERROR;
+ }
x = xive_from_pc_blk(blk);
if (!x) {
prerror("XIVE: Instance not found for allocated VP"