Module: Mesa
Branch: master
Commit: 94d8fbd21768987d1bde0e31bdcabf7004b8f9b8
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=94d8fbd21768987d1bde0e31bdcabf7004b8f9b8

Author: Rob Clark <[email protected]>
Date:   Thu Jun  2 16:23:36 2016 -0400

freedreno: fix bad bitshift warnings

Coverity doesn't realize idx will never be negative.  Throw in some
assert()s to help it out.

(Hopefully assert() isn't getting compiled out for coverity build.. but
there seems to be just one way to find out.  We might have to change
these to assume())

Fixes CID 1362442, 1362443

Signed-off-by: Rob Clark <[email protected]>

---

 src/gallium/drivers/freedreno/freedreno_query_hw.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/freedreno/freedreno_query_hw.c 
b/src/gallium/drivers/freedreno/freedreno_query_hw.c
index 04452ef..95fff3f 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_hw.c
+++ b/src/gallium/drivers/freedreno/freedreno_query_hw.c
@@ -94,6 +94,7 @@ resume_query(struct fd_context *ctx, struct fd_hw_query *hq,
                struct fd_ringbuffer *ring)
 {
        int idx = pidx(hq->provider->query_type);
+       assert(idx >= 0);   /* query never would have been created otherwise */
        assert(!hq->period);
        ctx->active_providers |= (1 << idx);
        hq->period = util_slab_alloc(&ctx->sample_period_pool);
@@ -108,6 +109,7 @@ pause_query(struct fd_context *ctx, struct fd_hw_query *hq,
                struct fd_ringbuffer *ring)
 {
        int idx = pidx(hq->provider->query_type);
+       assert(idx >= 0);   /* query never would have been created otherwise */
        assert(hq->period && !hq->period->end);
        assert(ctx->active_providers & (1 << idx));
        hq->period->end = get_sample(ctx, ring, hq->base.type);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to