@@ -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;
get_ipmi_boot_mailbox_block() should return the actual size of the received IPMI mailbox data Signed-off-by: Maxim Polyakov <m.polyakov@yadro.com> --- discover/platform-powerpc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)