diff options
-rw-r--r-- | mboxd_windows.c | 13 | ||||
-rw-r--r-- | test/vpnor/Makefile.am.include | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/mboxd_windows.c b/mboxd_windows.c index 275f38a..233bfdd 100644 --- a/mboxd_windows.c +++ b/mboxd_windows.c @@ -592,7 +592,10 @@ int create_map_window(struct mbox_context *context, } #endif - if ((offset + cur->size) > context->flash_size) { + if (offset > context->flash_size) { + MSG_ERR("Tried to open read window past flash limit\n"); + return -MBOX_R_PARAM_ERROR; + } else if ((offset + cur->size) > context->flash_size) { /* * There is V1 skiboot implementations out there which don't * mask offset with window size, meaning when we have @@ -607,9 +610,11 @@ int create_map_window(struct mbox_context *context, cur->size = align_down(context->flash_size - offset, 1 << context->block_size_shift); } else { - /* Trying to read past the end of flash */ - MSG_ERR("Tried to open read window past flash limit\n"); - return -MBOX_R_PARAM_ERROR; + /* + * Allow requests to exceed the flash size, but limit + * the response to the size of the flash. + */ + cur->size = context->flash_size - offset; } } diff --git a/test/vpnor/Makefile.am.include b/test/vpnor/Makefile.am.include index 5f71697..ed637bc 100644 --- a/test/vpnor/Makefile.am.include +++ b/test/vpnor/Makefile.am.include @@ -316,6 +316,4 @@ check_PROGRAMS += \ %reldir%/dump_flash \ %reldir%/create_read_window_size \ %reldir%/create_read_window_remap - -XFAIL_TESTS += %reldir%/dump_flash endif |