diff options
author | Stefan Wahren <stefan.wahren@i2se.com> | 2016-10-31 14:39:31 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-07 11:05:47 +0100 |
commit | 0feb1ed5c51acd5cea3d65221e8693c3c4bb4c8d (patch) | |
tree | f558dfa88ed0f7c63ae426c5a9be624a512ee4ad /drivers | |
parent | 6d5f49a9f618806e2826d66215bd38c4dd9b3d16 (diff) | |
download | linux-0feb1ed5c51acd5cea3d65221e8693c3c4bb4c8d.tar.bz2 |
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: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 6ea8f1335b78..90296c268a79 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -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); |