intel: make sure VG_CLEAR() will always do memory clear
PATCH 1/1 intel: make sure VG_CLEAR() will always do memory clear
If valgrind is not available, current VG_CLEAR() would just ignore memory clear operation which might make invalid ioctl argument. So make sure VG_CLEAR() will always clear memory.
--- intel/intel_bufmgr_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +1 -1
@@ -74,7 +74,7 @@#define VG (x)#endif -#define VG_CLEAR (s) VG(memset(&s, 0, sizeof(s))) +#define VG_CLEAR (s) (memset(&s, 0, sizeof(s)))#define DBG (...) do { \ if (bufmgr_gem->bufmgr.debug) \
Signature · 1 line
1.8.4.3
Quoted 12 lines · Zhenyu Wang
If valgrind is not available, current
VG_CLEAR()would just ignore memory clear operation which might make invalid ioctl argument. So make sureVG_CLEAR()will always clear memory.--- intel/intel_bufmgr_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)intel/intel_bufmgr_gem.c +0
-0
intel/intel_bufmgr_gem.c line 77
Quoted 5 lines
intel/intel_bufmgr_gem.c +1
-1@@ -74,7 +74,7 @@#define VG (x)#endif -#define VG_CLEAR (s) VG(memset(&s, 0, sizeof(s))) +#define VG_CLEAR (s) (memset(&s, 0, sizeof(s)))
VG_CLEAR() is really just for valgrind. If you need to set some specific variable/field to 0 then you need to set it to 0 and not rely on VG_CLEAR() to do it for you.
What's the actual issue you have?
Signature · 1 line
Damien
Quoted 16 lines · Damien Lespiau
Quoted 15 lines · Zhenyu Wang
If valgrind is not available, current
VG_CLEAR()would just ignore memory clear operation which might make invalid ioctl argument. So make sureVG_CLEAR()will always clear memory.--- intel/intel_bufmgr_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)intel/intel_bufmgr_gem.c +0
-0@@ -74,7 +74,7 @@#define VG (x)#endif
Quoted 7 lines
intel/intel_bufmgr_gem.c line 77
Quoted 2 lines
intel/intel_bufmgr_gem.c +1
-1-#define VG_CLEAR (s) VG(memset(&s, 0, sizeof(s))) +#define VG_CLEAR (s) (memset(&s, 0, sizeof(s)))
VG_CLEAR()is really just for valgrind. If you need to set some specific variable/field to 0 then you need to set it to 0 and not rely onVG_CLEAR()to do it for you.
ok, in valgrind case it does memory clear for ioctl args which I think is good behavior in non-valgrind case too.
Quoted 2 lines
What's the actual issue you have?
During testing on recent get reset status ioctl, if !HAVE_VALGRIND, stats argument is not cleared, which failed in kernel check.
Signature · 3 lines
Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Zhenyu Wang
Quoted 4 lines
VG_CLEAR()is really just for valgrind. If you need to set some specific variable/field to 0 then you need to set it to 0 and not rely onVG_CLEAR()to do it for you.ok, in valgrind case it does memory clear for ioctl args which I think is good behavior in non-valgrind case too.
Ian just submitted a patch that memset the whole structure.
Quoted 5 lines
Quoted 2 lines
What's the actual issue you have?
During testing on recent get reset status ioctl, if !HAVE_VALGRIND, stats argument is not cleared, which failed in kernel check.
Right, so the fix is (was) to zero the fields checked by the kernel explicitely, not change the VG() macro, which is just used in testing (and it should this way).
HTH,
Signature · 1 line
Damien
Quoted 4 lines · Damien Lespiau
Right, so the fix is (was) to zero the fields checked by the kernel explicitely, not change the
VG()macro, which is just used in testing (and it should this way).
That's fine. Thanks.
Signature · 3 lines
Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx