qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: riku.voipio@linaro.org
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PULL v2 1/8] linux-user: fix realloc size of target_fd_trans.
Date: Thu, 25 Feb 2016 13:01:06 +0200	[thread overview]
Message-ID: <5089c7ce82a49e6a97c5cf3db57a89bca8ed25d8.1456397907.git.riku.voipio@linaro.org> (raw)
In-Reply-To: <cover.1456397907.git.riku.voipio@linaro.org>

From: Laurent Vivier <laurent@vivier.eu>

target_fd_trans is an array of "TargetFdTrans *": compute size
accordingly. Use g_renew() as proposed by Paolo.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 linux-user/syscall.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 54ce14a..dac5518 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -318,8 +318,8 @@ static void fd_trans_register(int fd, TargetFdTrans *trans)
     if (fd >= target_fd_max) {
         oldmax = target_fd_max;
         target_fd_max = ((fd >> 6) + 1) << 6; /* by slice of 64 entries */
-        target_fd_trans = g_realloc(target_fd_trans,
-                                    target_fd_max * sizeof(TargetFdTrans));
+        target_fd_trans = g_renew(TargetFdTrans *,
+                                  target_fd_trans, target_fd_max);
         memset((void *)(target_fd_trans + oldmax), 0,
                (target_fd_max - oldmax) * sizeof(TargetFdTrans *));
     }
-- 
2.1.4

  reply	other threads:[~2016-02-25 11:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 11:01 [Qemu-devel] [PULL v2 0/8] linux-user updates and fixes riku.voipio
2016-02-25 11:01 ` riku.voipio [this message]
2016-02-25 11:01 ` [Qemu-devel] [PULL v2 2/8] build: [linux-user] Rename "syscall.h" to "target_syscall.h" in target directories riku.voipio
2016-02-25 11:01 ` [Qemu-devel] [PULL v2 3/8] linux-user: set ppc64/ppc64le default CPU to POWER8 riku.voipio
2016-05-25  5:38   ` Riku Voipio
2016-02-25 11:01 ` [Qemu-devel] [PULL v2 4/8] linux-user: Don't assert if guest tries shmdt(0) riku.voipio
2016-02-25 11:01 ` [Qemu-devel] [PULL v2 5/8] linux-user: sync syscall numbers with kernel riku.voipio
2016-02-25 11:01 ` [Qemu-devel] [PULL v2 6/8] linux-user: remove unavailable syscalls from aarch64 riku.voipio
2016-02-25 11:01 ` [Qemu-devel] [PULL v2 7/8] linux-user: correct timerfd_create syscall numbers riku.voipio
2016-02-25 11:01 ` [Qemu-devel] [PULL v2 8/8] linux-user: add getrandom() syscall riku.voipio
2016-02-25 12:13 ` [Qemu-devel] [PULL v2 0/8] linux-user updates and fixes Peter Maydell

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=5089c7ce82a49e6a97c5cf3db57a89bca8ed25d8.1456397907.git.riku.voipio@linaro.org \
    --to=riku.voipio@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /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 NNTP newsgroup(s).