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

Author: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Date:   Wed Aug  2 22:32:25 2017 +0100

intel: decoder: move field name copy

This should be inside the function that actually decodes fields.

Signed-off-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Reviewed-by: Scott D Phillips <scott.d.phill...@intel.com>

---

 src/intel/common/gen_decoder.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index bd3e139404..4ef285667d 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -823,7 +823,7 @@ iter_advance_field(struct gen_field_iterator *iter)
 
    iter->field = iter->field->next;
    if (iter->field->name)
-       strncpy(iter->name, iter->field->name, sizeof(iter->name));
+      strncpy(iter->name, iter->field->name, sizeof(iter->name));
    else
       memset(iter->name, 0, sizeof(iter->name));
 
@@ -848,7 +848,12 @@ gen_field_iterator_next(struct gen_field_iterator *iter)
    if (!iter_advance_field(iter))
       return false;
 
-   if ((iter->end - iter->start) > 32)
+   if (iter->field->name)
+      strncpy(iter->name, iter->field->name, sizeof(iter->name));
+   else
+      memset(iter->name, 0, sizeof(iter->name));
+
+   if ((iter->field->end - iter->field->start) > 32)
       v.qw = ((uint64_t) iter->p[iter->dword+1] << 32) | iter->p[iter->dword];
    else
       v.qw = iter->p[iter->dword];

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to