Commit 0feb1ed5 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: vchiq_arm: handle error case of get_user_pages

It's possible that get_user_pages() could fail. So evaluate its
return code and handle this error case properly.

This issue has been found by Cppcheck.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6d5f49a9
......@@ -1579,6 +1579,12 @@ dump_phys_mem(void *virt_addr, uint32_t num_bytes)
prev_idx = -1;
page = NULL;
if (rc < 0) {
vchiq_log_error(vchiq_arm_log_level,
"Failed to get user pages: %d\n", rc);
goto out;
}
while (offset < end_offset) {
int page_offset = offset % PAGE_SIZE;
......@@ -1602,6 +1608,8 @@ dump_phys_mem(void *virt_addr, uint32_t num_bytes)
offset += 16;
}
out:
if (page != NULL)
kunmap(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment