Hello.

Following patch fixes an invalid write in HSA plug-in.
I've been running bootstrap and regression tests on x86-linux-gnu.

Ready after it finishes?
Thanks,
Martin
>From 2674ceb5fddeaeb26ff87d26a43bddaf40060ea2 Mon Sep 17 00:00:00 2001
From: marxin <mli...@suse.cz>
Date: Mon, 21 Mar 2016 13:34:04 +0100
Subject: [PATCH] Allocate memory for shadow arg (PR hsa/70337)

libgomp/ChangeLog:

2016-03-21  Martin Liska  <mli...@suse.cz>

	PR hsa/70337
	* plugin/plugin-hsa.c (create_single_kernel_dispatch): Allocate
	memory for hsa_kernel_runtime * argument.
---
 libgomp/plugin/plugin-hsa.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libgomp/plugin/plugin-hsa.c b/libgomp/plugin/plugin-hsa.c
index d888493..36b3cf4 100644
--- a/libgomp/plugin/plugin-hsa.c
+++ b/libgomp/plugin/plugin-hsa.c
@@ -884,9 +884,10 @@ create_single_kernel_dispatch (struct kernel_info *kernel,
   shadow->private_segment_size = kernel->private_segment_size;
   shadow->group_segment_size = kernel->group_segment_size;
 
-  status
-    = hsa_memory_allocate (agent->kernarg_region, kernel->kernarg_segment_size,
-			   &shadow->kernarg_address);
+  size_t kernarg_size = kernel->kernarg_segment_size
+    + sizeof (struct hsa_kernel_runtime *);
+  status = hsa_memory_allocate (agent->kernarg_region, kernarg_size,
+				&shadow->kernarg_address);
   if (status != HSA_STATUS_SUCCESS)
     hsa_fatal ("Could not allocate memory for HSA kernel arguments", status);
 
-- 
2.7.1

Reply via email to