public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [HSA, PATCH] Allocate memory for shadow arg (PR hsa/70337)
@ 2016-03-21 13:05 Martin Liška
  2016-03-21 19:06 ` Martin Jambor
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Liška @ 2016-03-21 13:05 UTC (permalink / raw)
  To: GCC Patches; +Cc: Martin Jambor

[-- Attachment #1: Type: text/plain, Size: 171 bytes --]

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

[-- Attachment #2: 0001-Allocate-memory-for-shadow-arg-PR-hsa-70337.patch --]
[-- Type: text/x-patch, Size: 1314 bytes --]

From 2674ceb5fddeaeb26ff87d26a43bddaf40060ea2 Mon Sep 17 00:00:00 2001
From: marxin <mliska@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  <mliska@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-22 16:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-21 13:05 [HSA, PATCH] Allocate memory for shadow arg (PR hsa/70337) Martin Liška
2016-03-21 19:06 ` Martin Jambor
2016-03-21 20:58   ` Martin Liška
2016-03-22 16:51     ` Martin Jambor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).