qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: fix realloc size of target_fd_trans.
@ 2016-01-18 22:50 Laurent Vivier
  2016-02-01 13:40 ` Laurent Vivier
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Vivier @ 2016-01-18 22:50 UTC (permalink / raw)
  To: Riku Voipio; +Cc: pbonzini, qemu-devel, Laurent Vivier

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>
---
 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 *));
     }
-- 
2.5.0

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

* Re: [Qemu-devel] [PATCH] linux-user: fix realloc size of target_fd_trans.
  2016-01-18 22:50 [Qemu-devel] [PATCH] linux-user: fix realloc size of target_fd_trans Laurent Vivier
@ 2016-02-01 13:40 ` Laurent Vivier
  2016-02-15 12:13   ` Riku Voipio
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Vivier @ 2016-02-01 13:40 UTC (permalink / raw)
  To: Riku Voipio; +Cc: pbonzini, qemu-devel

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 <pbonzini@redhat.com>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  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 *));
>      }
> 

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

* Re: [Qemu-devel] [PATCH] linux-user: fix realloc size of target_fd_trans.
  2016-02-01 13:40 ` Laurent Vivier
@ 2016-02-15 12:13   ` Riku Voipio
  0 siblings, 0 replies; 3+ messages in thread
From: Riku Voipio @ 2016-02-15 12:13 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: pbonzini, qemu-devel

Hi,

Applied to linux-user, thanks

Riku

On maanantaina 1. helmikuuta 2016 15.40.09 EET, Laurent Vivier wrote:
> 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 <pbonzini@redhat.com>
>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>> --- ...
>
>

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

end of thread, other threads:[~2016-02-15 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-18 22:50 [Qemu-devel] [PATCH] linux-user: fix realloc size of target_fd_trans Laurent Vivier
2016-02-01 13:40 ` Laurent Vivier
2016-02-15 12:13   ` Riku Voipio

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).