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
This commit is contained in:
Ramkumar Radhakrishnan
2014-01-31 20:03:01 -08:00
parent ec6bd69a1c
commit 36bd527bc8
16 changed files with 102 additions and 73 deletions

View File

@@ -486,7 +486,7 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
// 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 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
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;
}
}