summaryrefslogtreecommitdiffstats
path: root/libs/storage/IMountService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/storage/IMountService.cpp')
-rw-r--r--libs/storage/IMountService.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp
index 5701678..9db15b9 100644
--- a/libs/storage/IMountService.cpp
+++ b/libs/storage/IMountService.cpp
@@ -207,12 +207,19 @@ public:
ALOGD("getStorageUsers caught exception %d\n", err);
return err;
}
- const int32_t numUsers = reply.readInt32();
+ int32_t numUsersI = reply.readInt32();
+ uint32_t numUsers;
+ if (numUsersI < 0) {
+ ALOGW("Number of users is negative: %d\n", numUsersI);
+ numUsers = 0;
+ } else {
+ numUsers = static_cast<uint32_t>(numUsersI);
+ }
*users = (int32_t*)malloc(sizeof(int32_t)*numUsers);
- for (int i = 0; i < numUsers; i++) {
+ for (size_t i = 0; i < numUsers; i++) {
**users++ = reply.readInt32();
}
- return numUsers;
+ return static_cast<int32_t>(numUsers);
}
int32_t getVolumeState(const String16& mountPoint)
@@ -544,8 +551,8 @@ public:
}
};
-IMPLEMENT_META_INTERFACE(MountService, "IMountService");
+IMPLEMENT_META_INTERFACE(MountService, "IMountService")
// ----------------------------------------------------------------------
-};
+}