nv50/query: fix stringop-overflow gcc warning
authorKarol Herbst <kherbst@redhat.com>
Fri, 30 Apr 2021 11:00:40 +0000 (13:00 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 3 May 2021 10:21:05 +0000 (10:21 +0000)
gcc warning:
../src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c: In function ‘nv50_hw_metric_get_query_result’:
../src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c:140:26: warning: ‘sm11_hw_metric_calc_result’ accessing 64 bytes in a region of size 32 [-Wstringop-overflow=]
  140 |    *(uint64_t *)result = sm11_hw_metric_calc_result(hq, res64);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c:140:26: note: referencing argument 2 of type ‘uint64_t *’ {aka ‘long unsigned int *’}
../src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c:105:1: note: in a call to function ‘sm11_hw_metric_calc_result’
  105 | sm11_hw_metric_calc_result(struct nv50_hw_query *hq, uint64_t res64[8])
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10544>

src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c

index f42a04e..eaacb85 100644 (file)
@@ -102,7 +102,7 @@ nv50_hw_metric_end_query(struct nv50_context *nv50, struct nv50_hw_query *hq)
 }
 
 static uint64_t
-sm11_hw_metric_calc_result(struct nv50_hw_query *hq, uint64_t res64[8])
+sm11_hw_metric_calc_result(struct nv50_hw_query *hq, uint64_t res64[4])
 {
    switch (hq->base.type - NV50_HW_METRIC_QUERY(0)) {
    case NV50_HW_METRIC_QUERY_BRANCH_EFFICIENCY: