[Mesa-dev] [PATCH] nouveau: Explicitly upcast operands so mulitplication is 64-bit.

Vinson Lee vlee at freedesktop.org
Thu Aug 29 22:03:03 PDT 2013


Fixes "Unintentional integer overflow" defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/gallium/drivers/nouveau/nouveau_vp3_video.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.h b/src/gallium/drivers/nouveau/nouveau_vp3_video.h
index 0193ed0..700d619 100644
--- a/src/gallium/drivers/nouveau/nouveau_vp3_video.h
+++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.h
@@ -152,9 +152,9 @@ nouveau_vp3_video_addr(struct nouveau_vp3_decoder *dec, struct nouveau_vp3_video
 {
    uint64_t ret;
    if (target)
-      ret = dec->ref_stride * target->valid_ref;
+      ret = (uint64_t)dec->ref_stride * target->valid_ref;
    else
-      ret = dec->ref_stride * (dec->base.max_references+1);
+      ret = (uint64_t)dec->ref_stride * (dec->base.max_references+1);
    return dec->ref_bo->offset + ret;
 }
 
-- 
1.8.3.1



More information about the mesa-dev mailing list