diff mbox

[i-g-t,3/3] tests/gem_seqno_wrap: fix over allocation of buffers

Message ID 1391792619-17110-4-git-send-email-thomas.wood@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Wood Feb. 7, 2014, 5:03 p.m. UTC
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 tests/gem_seqno_wrap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Thomas Wood Feb. 7, 2014, 5:32 p.m. UTC | #1
> [PATCH i-g-t 3/3] tests/gem_seqno_wrap: fix over allocation of buffers

For clarity, this should probably be "fix over allocation of arrays",
since the arrays were being allocated as an array of buffers instead
of an array of pointers to buffers.

Regards,

Thomas
Daniel Vetter Feb. 10, 2014, 9:04 a.m. UTC | #2
On Fri, Feb 07, 2014 at 05:32:26PM +0000, Thomas Wood wrote:
> > [PATCH i-g-t 3/3] tests/gem_seqno_wrap: fix over allocation of buffers
> 
> For clarity, this should probably be "fix over allocation of arrays",
> since the arrays were being allocated as an array of buffers instead
> of an array of pointers to buffers.

All patches merged, thanks. btw I've also switched to calloc - it's good
security style to use an explicit array allocation function since those
handle overflows already. But not worth the bother of another patch for
testcases ;-)
-Daniel
diff mbox

Patch

diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c
index 40c6227..e37365f 100644
--- a/tests/gem_seqno_wrap.c
+++ b/tests/gem_seqno_wrap.c
@@ -207,13 +207,13 @@  static int run_sync_test(int num_buffers, bool verify)
 	batch_3d = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
 	igt_assert(batch_3d);
 
-	src = malloc(num_buffers * sizeof(**src));
+	src = malloc(num_buffers * sizeof(*src));
 	igt_assert(src);
 
-	dst1 = malloc(num_buffers * sizeof(**dst1));
+	dst1 = malloc(num_buffers * sizeof(*dst1));
 	igt_assert(dst1);
 
-	dst2 = malloc(num_buffers * sizeof(**dst2));
+	dst2 = malloc(num_buffers * sizeof(*dst2));
 	igt_assert(dst2);
 
 	s_src = malloc(num_buffers * sizeof(*s_src));