summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-06-09 07:23:33 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-06-09 07:23:34 +0000
commit65d3486b2fd5dcff52dae8697ec471ab1ad577b8 (patch)
treeef1c5242d86fa26474511b06c4a1510138bed18d
parent758ee46f08d307e4b6750889cf49105a82525bec (diff)
parent13058cb71f03066fb81d1652f3dc3ffa050f3c7b (diff)
downloadandroid_hardware_ril-65d3486b2fd5dcff52dae8697ec471ab1ad577b8.tar.gz
android_hardware_ril-65d3486b2fd5dcff52dae8697ec471ab1ad577b8.tar.bz2
android_hardware_ril-65d3486b2fd5dcff52dae8697ec471ab1ad577b8.zip
Merge "Treat NULL payload in RIL messages as valid where applicable." into oc-dev
-rw-r--r--libril/ril_service.cpp51
1 files changed, 33 insertions, 18 deletions
diff --git a/libril/ril_service.cpp b/libril/ril_service.cpp
index 143a06f..a5fa8b9 100644
--- a/libril/ril_service.cpp
+++ b/libril/ril_service.cpp
@@ -2974,7 +2974,8 @@ int radio::getCurrentCallsResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<Call> calls;
- if (response == NULL || (responseLen % sizeof(RIL_Call *)) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || (responseLen % sizeof(RIL_Call *)) != 0) {
RLOGE("getCurrentCallsResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -3810,9 +3811,11 @@ int radio::setupDataCallResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
SetupDataCallResult result = {};
- if (response == NULL || responseLen != sizeof(RIL_Data_Call_Response_v11)) {
- RLOGE("setupDataCallResponse: Invalid response");
- if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ if (response == NULL || (responseLen % sizeof(RIL_Data_Call_Response_v11)) != 0) {
+ if (response != NULL) {
+ RLOGE("setupDataCallResponse: Invalid response");
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ }
result.status = DataCallFailCause::ERROR_UNSPECIFIED;
result.type = hidl_string();
result.ifname = hidl_string();
@@ -3978,7 +3981,8 @@ int radio::getCallForwardStatusResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CallForwardInfo> callForwardInfos;
- if (response == NULL || responseLen % sizeof(RIL_CallForwardInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CallForwardInfo *) != 0) {
RLOGE("getCallForwardStatusResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -4306,7 +4310,8 @@ int radio::getAvailableNetworksResponse(int slotId,
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<OperatorInfo> networks;
- if (response == NULL || responseLen % (4 * sizeof(char *))!= 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % (4 * sizeof(char *))!= 0) {
RLOGE("getAvailableNetworksResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -4500,7 +4505,8 @@ int radio::getDataCallListResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<SetupDataCallResult> ret;
- if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
RLOGE("getDataCallListResponse: invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -4610,7 +4616,7 @@ int radio::getAvailableBandModesResponse(int slotId,
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<RadioBandMode> modes;
- if (response == NULL || responseLen % sizeof(int) != 0) {
+ if ((response == NULL && responseLen != 0)|| responseLen % sizeof(int) != 0) {
RLOGE("getAvailableBandModesResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -4777,7 +4783,8 @@ int radio::getNeighboringCidsResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<NeighboringCell> cells;
- if (response == NULL || responseLen % sizeof(RIL_NeighboringCell *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_NeighboringCell *) != 0) {
RLOGE("getNeighboringCidsResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -5080,7 +5087,8 @@ int radio::getGsmBroadcastConfigResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<GsmBroadcastSmsConfigInfo> configs;
- if (response == NULL || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) {
RLOGE("getGsmBroadcastConfigResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -5164,7 +5172,8 @@ int radio::getCdmaBroadcastConfigResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CdmaBroadcastSmsConfigInfo> configs;
- if (response == NULL || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) {
RLOGE("getCdmaBroadcastConfigResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -5585,7 +5594,8 @@ int radio::getCellInfoListResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CellInfo> ret;
- if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
RLOGE("getCellInfoListResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -5739,7 +5749,9 @@ int radio::iccOpenLogicalChannelResponse(int slotId,
int numInts = responseLen / sizeof(int);
if (response == NULL || responseLen % sizeof(int) != 0) {
RLOGE("iccOpenLogicalChannelResponse Invalid response: NULL");
- if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ if (response != NULL) {
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ }
} else {
int *pInt = (int *) response;
channelId = pInt[0];
@@ -5940,7 +5952,8 @@ int radio::getHardwareConfigResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<HardwareConfig> result;
- if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_HardwareConfig) != 0) {
RLOGE("hardwareConfigChangedInd: invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -6390,7 +6403,7 @@ int radio::sendRequestStringsResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<hidl_string> data;
- if (response == NULL || responseLen % sizeof(char *) != 0) {
+ if ((response == NULL && responseLen != 0) || responseLen % sizeof(char *) != 0) {
RLOGE("sendRequestStringsResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -6738,7 +6751,8 @@ int radio::dataCallListChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
RLOGE("dataCallListChangedInd: invalid response");
return 0;
}
@@ -7621,7 +7635,7 @@ int radio::cellInfoListInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
+ if ((response == NULL && responseLen != 0) || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
RLOGE("cellInfoListInd: invalid response");
return 0;
}
@@ -7742,7 +7756,8 @@ int radio::hardwareConfigChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_HardwareConfig) != 0) {
RLOGE("hardwareConfigChangedInd: invalid response");
return 0;
}