public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ilya Verbin <iverbin@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Kirill Yukhin <kirill.yukhin@gmail.com>,
	Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH][committed] Fix PR67652: wrong sizeof calculation in liboffloadmic
Date: Mon, 28 Sep 2015 16:21:00 -0000	[thread overview]
Message-ID: <20150928161013.GC25312@msticlxl57.ims.intel.com> (raw)

Committed to trunk as obvious.

	PR other/67652
	* runtime/offload_engine.cpp (Engine::init_process): Fix sizeof.

diff --git a/liboffloadmic/runtime/offload_engine.cpp b/liboffloadmic/runtime/offload_engine.cpp
index 16b440d..00b673a 100644
--- a/liboffloadmic/runtime/offload_engine.cpp
+++ b/liboffloadmic/runtime/offload_engine.cpp
@@ -173,7 +173,7 @@ void Engine::init_process(void)
             // use putenv instead of setenv as Windows has no setenv.
             // Note: putenv requires its argument can't be freed or modified.
             // So no free after call to putenv or elsewhere.
-            char * env_var = (char*) malloc(sizeof("COI_DMA_CHANNEL_COUNT=2" + 1));
+            char * env_var = (char*) malloc(sizeof("COI_DMA_CHANNEL_COUNT=2"));
             sprintf(env_var, "COI_DMA_CHANNEL_COUNT=2");
             putenv(env_var);  
         }

  -- Ilya

             reply	other threads:[~2015-09-28 16:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28 16:21 Ilya Verbin [this message]
2015-09-28 16:30 ` Jakub Jelinek
2015-09-28 16:32   ` Ilya Verbin
2015-09-28 16:50   ` Andrew Pinski
2015-10-08 19:09     ` Ilya Verbin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150928161013.GC25312@msticlxl57.ims.intel.com \
    --to=iverbin@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=kirill.yukhin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).