[PATCH 5/7] staging: vchiq_arm: handle error case of get_user_pages
Stefan Wahren
stefan.wahren at i2se.com
Mon Oct 31 07:39:31 PDT 2016
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 at i2se.com>
---
.../vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++++++
1 file changed, 8 insertions(+)
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 ba124c6..be890f9 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1478,6 +1478,12 @@ static void close_delivered(USER_SERVICE_T *user_service)
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;
@@ -1501,6 +1507,8 @@ static void close_delivered(USER_SERVICE_T *user_service)
offset += 16;
}
+
+out:
if (page != NULL)
kunmap(page);
--
1.7.9.5
More information about the linux-rpi-kernel
mailing list