[PATCH v2 3/5] discover/platform-powerpc: return the actual mailbox size
Maxim Polyakov
m.polyakov at yadro.com
Mon Jul 8 19:13:18 AEST 2019
get_ipmi_boot_mailbox_block() should return the actual size
of the received IPMI mailbox data
Signed-off-by: Maxim Polyakov <m.polyakov at yadro.com>
---
discover/platform-powerpc.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index 1e33bf1..c874560 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -473,12 +473,7 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform,
return -1;
}
- if (resp_len == 4) {
- pb_debug_fn("block %hu empty\n", block);
- return 0;
- }
-
- blocksize = sizeof(resp) - 4;
+ blocksize = resp_len - 4;
pb_debug_fn("Mailbox block %hu returns only %zu bytes in block\n",
block, blocksize);
@@ -512,6 +507,12 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform,
return -1;
}
+ if (!blocksize) {
+ pb_debug_fn("block %hu empty\n", block);
+ return 0;
+ }
+
+
memcpy(buf, &resp[4], blocksize);
return blocksize;
--
2.7.4
More information about the Petitboot
mailing list