display: Remove klockwork warnings and errors.
Remove all klockwork warnings and errors for libgralloc,
libhwcomposer, liboverlay, libqdutils, libqservice, libvirtual,
libexternal libraries to avoid buffer overflow and memory leaks.
Change-Id: I078143bcbcf5e4b342156bd8305a644566f7cc4b
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index d94e0e9..e7ead9b 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -486,7 +486,7 @@
// the position based on the new width and height
if ((extOrientation & HWC_TRANSFORM_ROT_90) &&
isOrientationPortrait(ctx)) {
- hwc_rect_t r;
+ hwc_rect_t r = {0, 0, 0, 0};
//Calculate the position
xRatio = (outPos.x - xPos)/width;
// GetaspectRatio -- tricky to get the correct aspect ratio
@@ -1227,25 +1227,30 @@
for(uint32_t i = 0; i < ctx->mLayerRotMap[dpy]->getCount(); i++) {
int rotFd = ctx->mRotMgr->getRotDevFd();
int rotReleaseFd = -1;
+ overlay::Rotator* currRot = ctx->mLayerRotMap[dpy]->getRot(i);
+ hwc_layer_1_t* currLayer = ctx->mLayerRotMap[dpy]->getLayer(i);
+ if((currRot == NULL) || (currLayer == NULL)) {
+ continue;
+ }
struct mdp_buf_sync rotData;
memset(&rotData, 0, sizeof(rotData));
rotData.acq_fen_fd =
- &ctx->mLayerRotMap[dpy]->getLayer(i)->acquireFenceFd;
+ &currLayer->acquireFenceFd;
rotData.rel_fen_fd = &rotReleaseFd; //driver to populate this
- rotData.session_id = ctx->mLayerRotMap[dpy]->getRot(i)->getSessId();
+ rotData.session_id = currRot->getSessId();
int ret = 0;
ret = ioctl(rotFd, MSMFB_BUFFER_SYNC, &rotData);
if(ret < 0) {
ALOGE("%s: ioctl MSMFB_BUFFER_SYNC failed for rot sync, err=%s",
__FUNCTION__, strerror(errno));
} else {
- close(ctx->mLayerRotMap[dpy]->getLayer(i)->acquireFenceFd);
+ close(currLayer->acquireFenceFd);
//For MDP to wait on.
- ctx->mLayerRotMap[dpy]->getLayer(i)->acquireFenceFd =
+ currLayer->acquireFenceFd =
dup(rotReleaseFd);
//A buffer is free to be used by producer as soon as its copied to
//rotator
- ctx->mLayerRotMap[dpy]->getLayer(i)->releaseFenceFd =
+ currLayer->releaseFenceFd =
rotReleaseFd;
}
}