summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sdm/libs/hwc2/hwc_session_services.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/sdm/libs/hwc2/hwc_session_services.cpp b/sdm/libs/hwc2/hwc_session_services.cpp
index 90ed00b4..7600fc85 100644
--- a/sdm/libs/hwc2/hwc_session_services.cpp
+++ b/sdm/libs/hwc2/hwc_session_services.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -158,7 +158,8 @@ Return<int32_t> HWCSession::configureDynRefeshRate(IDisplayConfig::DisplayDynRef
}
int32_t HWCSession::GetConfigCount(int disp_id, uint32_t *count) {
- if (disp_id < 0) {
+ if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) {
+ DLOGE("Invalid display = %d", disp_id);
return -EINVAL;
}
@@ -182,7 +183,8 @@ Return<void> HWCSession::getConfigCount(IDisplayConfig::DisplayType dpy,
}
int32_t HWCSession::GetActiveConfigIndex(int disp_id, uint32_t *config) {
- if (disp_id < 0) {
+ if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) {
+ DLOGE("Invalid display = %d", disp_id);
return -EINVAL;
}
@@ -206,7 +208,8 @@ Return<void> HWCSession::getActiveConfig(IDisplayConfig::DisplayType dpy,
}
int32_t HWCSession::SetActiveConfigIndex(int disp_id, uint32_t config) {
- if (disp_id < 0) {
+ if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) {
+ DLOGE("Invalid display = %d", disp_id);
return -EINVAL;
}
@@ -295,7 +298,8 @@ Return<void> HWCSession::getPanelBrightness(getPanelBrightness_cb _hidl_cb) {
int32_t HWCSession::MinHdcpEncryptionLevelChanged(int disp_id, uint32_t min_enc_level) {
DLOGI("Display %d", disp_id);
- if (disp_id < 0) {
+ if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) {
+ DLOGE("Invalid display = %d", disp_id);
return -EINVAL;
}
@@ -324,7 +328,8 @@ Return<int32_t> HWCSession::refreshScreen() {
}
int32_t HWCSession::ControlPartialUpdate(int disp_id, bool enable) {
- if (disp_id < 0) {
+ if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) {
+ DLOGE("Invalid display = %d", disp_id);
return -EINVAL;
}