display: Add checks on GetActiveConfig API
This change adds null pointer checks on the GetActiveConfig API. Change-Id: Ic61507ab9fe083f85a7708e262ecdf7714cf9087 CRs-Fixed: 2784749
This commit is contained in:
@@ -140,6 +140,10 @@ int ClientImpl::GetConfigCount(DisplayType dpy, uint32_t *count) {
|
||||
}
|
||||
|
||||
int ClientImpl::GetActiveConfig(DisplayType dpy, uint32_t *config) {
|
||||
if (!config) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ByteStream input_params;
|
||||
input_params.setToExternal(reinterpret_cast<uint8_t*>(&dpy), sizeof(DisplayType));
|
||||
const uint32_t *output;
|
||||
@@ -150,11 +154,15 @@ int ClientImpl::GetActiveConfig(DisplayType dpy, uint32_t *config) {
|
||||
output_params = params;
|
||||
};
|
||||
|
||||
display_config_->perform(client_handle_, kGetActiveConfig, input_params, {}, hidl_cb);
|
||||
if (display_config_) {
|
||||
display_config_->perform(client_handle_, kGetActiveConfig, input_params, {}, hidl_cb);
|
||||
}
|
||||
|
||||
const uint8_t *data = output_params.data();
|
||||
output = reinterpret_cast<const uint32_t*>(data);
|
||||
*config = *output;
|
||||
if (!error) {
|
||||
const uint8_t *data = output_params.data();
|
||||
output = reinterpret_cast<const uint32_t*>(data);
|
||||
*config = *output;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ int DeviceImpl::CreateInstance(ClientContext *intf) {
|
||||
Return<void> DeviceImpl::registerClient(const hidl_string &client_name,
|
||||
const sp<IDisplayConfigCallback>& callback,
|
||||
registerClient_cb _hidl_cb) {
|
||||
ALOGI("Register client:%s", client_name.c_str());
|
||||
int32_t error = 0;
|
||||
std::string client_name_str = client_name.c_str();
|
||||
if (client_name_str.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user