Received: from eggs.gnu.org ([2001:4830:134:3::10]:48373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQEiU-0000ja-Lg for qemu-devel@nongnu.org; Mon, 01 Feb 2016 08:40:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQEiP-0000cp-NA for qemu-devel@nongnu.org; Mon, 01 Feb 2016 08:40:30 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:58056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQEiP-0000cO-EY for qemu-devel@nongnu.org; Mon, 01 Feb 2016 08:40:25 -0500 References: <1453157445-1433-1-git-send-email-laurent@vivier.eu> From: Laurent Vivier Message-ID: <56AF6039.70506@vivier.eu> Date: Mon, 1 Feb 2016 14:40:09 +0100 MIME-Version: 1.0 In-Reply-To: <1453157445-1433-1-git-send-email-laurent@vivier.eu> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] linux-user: fix realloc size of target_fd_trans. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Riku Voipio Cc: pbonzini@redhat.com, qemu-devel@nongnu.org Ping ? Le 18/01/2016 23:50, Laurent Vivier a écrit : > target_fd_trans is an array of "TargetFdTrans *": compute size > accordingly. Use g_renew() as proposed by Paolo. > > Reported-by: Paolo Bonzini > Signed-off-by: Laurent Vivier > --- > 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 0cbace4..fd04e5f 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -330,8 +330,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 *)); > } >