* [Qemu-trivial] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h @ 2016-03-23 18:32 Md Haris Iqbal 2016-03-29 15:53 ` haris iqbal ` (3 more replies) 0 siblings, 4 replies; 10+ messages in thread From: Md Haris Iqbal @ 2016-03-23 18:32 UTC (permalink / raw) To: qemu-devel; +Cc: qemu-trivial, Md Haris Iqbal Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> --- linux-user/qemu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 26b0ba2..3c3fd15 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy #ifdef DEBUG_REMAP { void *addr; - addr = malloc(len); + addr = g_malloc(len); if (copy) memcpy(addr, g2h(guest_addr), len); else @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, return; if (len > 0) memcpy(g2h(guest_addr), host_ptr, len); - free(host_ptr); + g_free(host_ptr); #endif } -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-23 18:32 [Qemu-trivial] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h Md Haris Iqbal @ 2016-03-29 15:53 ` haris iqbal 2016-03-30 14:06 ` haris iqbal 2016-03-30 14:09 ` [Qemu-trivial] [Qemu-devel] " Stefan Hajnoczi ` (2 subsequent siblings) 3 siblings, 1 reply; 10+ messages in thread From: haris iqbal @ 2016-03-29 15:53 UTC (permalink / raw) To: QEMU Developers; +Cc: QEMU Trivial, Md Haris Iqbal Hi, Can I get a respond for this patch. Is it complete, or did I miss something? On Thu, Mar 24, 2016 at 12:02 AM, Md Haris Iqbal <haris.phnx@gmail.com> wrote: > Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> > --- > linux-user/qemu.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/linux-user/qemu.h b/linux-user/qemu.h > index 26b0ba2..3c3fd15 100644 > --- a/linux-user/qemu.h > +++ b/linux-user/qemu.h > @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy > #ifdef DEBUG_REMAP > { > void *addr; > - addr = malloc(len); > + addr = g_malloc(len); > if (copy) > memcpy(addr, g2h(guest_addr), len); > else > @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, > return; > if (len > 0) > memcpy(g2h(guest_addr), host_ptr, len); > - free(host_ptr); > + g_free(host_ptr); > #endif > } > > -- > 1.9.1 > -- With regards, Md Haris Iqbal, Placement Coordinator, MTech IT NITK Surathkal, Contact: +91 8861996962 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-29 15:53 ` haris iqbal @ 2016-03-30 14:06 ` haris iqbal 0 siblings, 0 replies; 10+ messages in thread From: haris iqbal @ 2016-03-30 14:06 UTC (permalink / raw) To: QEMU Developers Cc: QEMU Trivial, Peter Maydell, Markus Armbruster, Paolo Bonzini Hi, Patch is attached in the previous mail. Looking forward to your review. On Tue, Mar 29, 2016 at 9:23 PM, haris iqbal <haris.phnx@gmail.com> wrote: > Hi, > > Can I get a respond for this patch. Is it complete, or did I miss something? > > > On Thu, Mar 24, 2016 at 12:02 AM, Md Haris Iqbal <haris.phnx@gmail.com> wrote: >> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> >> --- >> linux-user/qemu.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/linux-user/qemu.h b/linux-user/qemu.h >> index 26b0ba2..3c3fd15 100644 >> --- a/linux-user/qemu.h >> +++ b/linux-user/qemu.h >> @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy >> #ifdef DEBUG_REMAP >> { >> void *addr; >> - addr = malloc(len); >> + addr = g_malloc(len); >> if (copy) >> memcpy(addr, g2h(guest_addr), len); >> else >> @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, >> return; >> if (len > 0) >> memcpy(g2h(guest_addr), host_ptr, len); >> - free(host_ptr); >> + g_free(host_ptr); >> #endif >> } >> >> -- >> 1.9.1 >> > > > > -- > > With regards, > > Md Haris Iqbal, > Placement Coordinator, MTech IT > NITK Surathkal, > Contact: +91 8861996962 -- With regards, Md Haris Iqbal, Placement Coordinator, MTech IT NITK Surathkal, Contact: +91 8861996962 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-23 18:32 [Qemu-trivial] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h Md Haris Iqbal 2016-03-29 15:53 ` haris iqbal @ 2016-03-30 14:09 ` Stefan Hajnoczi 2016-03-30 16:28 ` haris iqbal 2016-05-05 17:26 ` Stefan Hajnoczi 2016-09-14 7:24 ` [Qemu-trivial] " Michael Tokarev 3 siblings, 1 reply; 10+ messages in thread From: Stefan Hajnoczi @ 2016-03-30 14:09 UTC (permalink / raw) To: Md Haris Iqbal; +Cc: qemu-trivial, qemu-devel [-- Attachment #1: Type: text/plain, Size: 1175 bytes --] On Thu, Mar 24, 2016 at 12:02:03AM +0530, Md Haris Iqbal wrote: > Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> > --- > linux-user/qemu.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/linux-user/qemu.h b/linux-user/qemu.h > index 26b0ba2..3c3fd15 100644 > --- a/linux-user/qemu.h > +++ b/linux-user/qemu.h > @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy > #ifdef DEBUG_REMAP > { > void *addr; > - addr = malloc(len); > + addr = g_malloc(len); > if (copy) > memcpy(addr, g2h(guest_addr), len); > else > @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, > return; > if (len > 0) > memcpy(g2h(guest_addr), host_ptr, len); > - free(host_ptr); > + g_free(host_ptr); > #endif > } If I understand correctly either lock_user() or lock_user_string() may be followed by unlock_user(). If you change unlock_user() to g_free() then you also need to change lock_user_string() to g_malloc() to avoid a malloc()/g_free() mismatch. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-30 14:09 ` [Qemu-trivial] [Qemu-devel] " Stefan Hajnoczi @ 2016-03-30 16:28 ` haris iqbal 2016-03-31 9:42 ` Stefan Hajnoczi 0 siblings, 1 reply; 10+ messages in thread From: haris iqbal @ 2016-03-30 16:28 UTC (permalink / raw) To: Stefan Hajnoczi Cc: QEMU Trivial, Paolo Bonzini, QEMU Developers, Markus Armbruster, Peter Maydell On Wed, Mar 30, 2016 at 7:39 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote: > On Thu, Mar 24, 2016 at 12:02:03AM +0530, Md Haris Iqbal wrote: >> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> >> --- >> linux-user/qemu.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/linux-user/qemu.h b/linux-user/qemu.h >> index 26b0ba2..3c3fd15 100644 >> --- a/linux-user/qemu.h >> +++ b/linux-user/qemu.h >> @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy >> #ifdef DEBUG_REMAP >> { >> void *addr; >> - addr = malloc(len); >> + addr = g_malloc(len); >> if (copy) >> memcpy(addr, g2h(guest_addr), len); >> else >> @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, >> return; >> if (len > 0) >> memcpy(g2h(guest_addr), host_ptr, len); >> - free(host_ptr); >> + g_free(host_ptr); >> #endif >> } > > If I understand correctly either lock_user() or lock_user_string() may > be followed by unlock_user(). If you change unlock_user() to g_free() > then you also need to change lock_user_string() to g_malloc() to avoid a > malloc()/g_free() mismatch. lock_user_string() does not use malloc itself, but calls lock_user() from itself. -- With regards, Md Haris Iqbal, Placement Coordinator, MTech IT NITK Surathkal, Contact: +91 8861996962 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-30 16:28 ` haris iqbal @ 2016-03-31 9:42 ` Stefan Hajnoczi 2016-03-31 10:57 ` haris iqbal 0 siblings, 1 reply; 10+ messages in thread From: Stefan Hajnoczi @ 2016-03-31 9:42 UTC (permalink / raw) To: haris iqbal Cc: QEMU Trivial, Paolo Bonzini, QEMU Developers, Markus Armbruster, Peter Maydell [-- Attachment #1: Type: text/plain, Size: 1779 bytes --] On Wed, Mar 30, 2016 at 09:58:41PM +0530, haris iqbal wrote: > On Wed, Mar 30, 2016 at 7:39 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote: > > On Thu, Mar 24, 2016 at 12:02:03AM +0530, Md Haris Iqbal wrote: > >> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> > >> --- > >> linux-user/qemu.h | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/linux-user/qemu.h b/linux-user/qemu.h > >> index 26b0ba2..3c3fd15 100644 > >> --- a/linux-user/qemu.h > >> +++ b/linux-user/qemu.h > >> @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy > >> #ifdef DEBUG_REMAP > >> { > >> void *addr; > >> - addr = malloc(len); > >> + addr = g_malloc(len); > >> if (copy) > >> memcpy(addr, g2h(guest_addr), len); > >> else > >> @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, > >> return; > >> if (len > 0) > >> memcpy(g2h(guest_addr), host_ptr, len); > >> - free(host_ptr); > >> + g_free(host_ptr); > >> #endif > >> } > > > > If I understand correctly either lock_user() or lock_user_string() may > > be followed by unlock_user(). If you change unlock_user() to g_free() > > then you also need to change lock_user_string() to g_malloc() to avoid a > > malloc()/g_free() mismatch. > > lock_user_string() does not use malloc itself, but calls lock_user() > from itself. You are right. The reason I got confused is because there are 3 versions of lock_user(): linux-user, bsd-user, and include/exec/softmmu-semi.h. Please send equivalent patches for the other 2 versions as well. This way they stay consistent. Thanks, Stefan [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-31 9:42 ` Stefan Hajnoczi @ 2016-03-31 10:57 ` haris iqbal 2016-05-03 9:47 ` haris iqbal 0 siblings, 1 reply; 10+ messages in thread From: haris iqbal @ 2016-03-31 10:57 UTC (permalink / raw) To: Stefan Hajnoczi Cc: QEMU Trivial, Paolo Bonzini, QEMU Developers, Markus Armbruster, Peter Maydell On Thu, Mar 31, 2016 at 3:12 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote: > On Wed, Mar 30, 2016 at 09:58:41PM +0530, haris iqbal wrote: >> On Wed, Mar 30, 2016 at 7:39 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote: >> > On Thu, Mar 24, 2016 at 12:02:03AM +0530, Md Haris Iqbal wrote: >> >> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> >> >> --- >> >> linux-user/qemu.h | 4 ++-- >> >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> >> >> diff --git a/linux-user/qemu.h b/linux-user/qemu.h >> >> index 26b0ba2..3c3fd15 100644 >> >> --- a/linux-user/qemu.h >> >> +++ b/linux-user/qemu.h >> >> @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy >> >> #ifdef DEBUG_REMAP >> >> { >> >> void *addr; >> >> - addr = malloc(len); >> >> + addr = g_malloc(len); >> >> if (copy) >> >> memcpy(addr, g2h(guest_addr), len); >> >> else >> >> @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, >> >> return; >> >> if (len > 0) >> >> memcpy(g2h(guest_addr), host_ptr, len); >> >> - free(host_ptr); >> >> + g_free(host_ptr); >> >> #endif >> >> } >> > >> > If I understand correctly either lock_user() or lock_user_string() may >> > be followed by unlock_user(). If you change unlock_user() to g_free() >> > then you also need to change lock_user_string() to g_malloc() to avoid a >> > malloc()/g_free() mismatch. >> >> lock_user_string() does not use malloc itself, but calls lock_user() >> from itself. > > You are right. The reason I got confused is because there are 3 > versions of lock_user(): linux-user, bsd-user, and > include/exec/softmmu-semi.h. > > Please send equivalent patches for the other 2 versions as well. This > way they stay consistent. Will do. Actually as they different files, I was told to send patches separately. And I wanted to wait till this one is reviewed, so I don't repeat any mistake if there are in this one. > > Thanks, > Stefan -- With regards, Md Haris Iqbal, Placement Coordinator, MTech IT NITK Surathkal, Contact: +91 8861996962 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-31 10:57 ` haris iqbal @ 2016-05-03 9:47 ` haris iqbal 0 siblings, 0 replies; 10+ messages in thread From: haris iqbal @ 2016-05-03 9:47 UTC (permalink / raw) To: Stefan Hajnoczi Cc: QEMU Developers, QEMU Trivial, Paolo Bonzini, Peter Maydell, Markus Armbruster Just a reminder. any more changes needed for this patch? or can it be merged? On Thu, Mar 31, 2016 at 4:27 PM, haris iqbal <haris.phnx@gmail.com> wrote: > On Thu, Mar 31, 2016 at 3:12 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote: >> On Wed, Mar 30, 2016 at 09:58:41PM +0530, haris iqbal wrote: >>> On Wed, Mar 30, 2016 at 7:39 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote: >>> > On Thu, Mar 24, 2016 at 12:02:03AM +0530, Md Haris Iqbal wrote: >>> >> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> >>> >> --- >>> >> linux-user/qemu.h | 4 ++-- >>> >> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >> >>> >> diff --git a/linux-user/qemu.h b/linux-user/qemu.h >>> >> index 26b0ba2..3c3fd15 100644 >>> >> --- a/linux-user/qemu.h >>> >> +++ b/linux-user/qemu.h >>> >> @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy >>> >> #ifdef DEBUG_REMAP >>> >> { >>> >> void *addr; >>> >> - addr = malloc(len); >>> >> + addr = g_malloc(len); >>> >> if (copy) >>> >> memcpy(addr, g2h(guest_addr), len); >>> >> else >>> >> @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, >>> >> return; >>> >> if (len > 0) >>> >> memcpy(g2h(guest_addr), host_ptr, len); >>> >> - free(host_ptr); >>> >> + g_free(host_ptr); >>> >> #endif >>> >> } >>> > >>> > If I understand correctly either lock_user() or lock_user_string() may >>> > be followed by unlock_user(). If you change unlock_user() to g_free() >>> > then you also need to change lock_user_string() to g_malloc() to avoid a >>> > malloc()/g_free() mismatch. >>> >>> lock_user_string() does not use malloc itself, but calls lock_user() >>> from itself. >> >> You are right. The reason I got confused is because there are 3 >> versions of lock_user(): linux-user, bsd-user, and >> include/exec/softmmu-semi.h. >> >> Please send equivalent patches for the other 2 versions as well. This >> way they stay consistent. > > Will do. Actually as they different files, I was told to send patches > separately. > > And I wanted to wait till this one is reviewed, so I don't repeat any > mistake if there are in this one. > >> >> Thanks, >> Stefan > > > > -- > > With regards, > > Md Haris Iqbal, > Placement Coordinator, MTech IT > NITK Surathkal, > Contact: +91 8861996962 -- With regards, Md Haris Iqbal, Placement Coordinator, MTech IT NITK Surathkal, Contact: +91 8861996962 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-23 18:32 [Qemu-trivial] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h Md Haris Iqbal 2016-03-29 15:53 ` haris iqbal 2016-03-30 14:09 ` [Qemu-trivial] [Qemu-devel] " Stefan Hajnoczi @ 2016-05-05 17:26 ` Stefan Hajnoczi 2016-09-14 7:24 ` [Qemu-trivial] " Michael Tokarev 3 siblings, 0 replies; 10+ messages in thread From: Stefan Hajnoczi @ 2016-05-05 17:26 UTC (permalink / raw) To: Md Haris Iqbal; +Cc: qemu-devel, qemu-trivial [-- Attachment #1: Type: text/plain, Size: 258 bytes --] On Thu, Mar 24, 2016 at 12:02:03AM +0530, Md Haris Iqbal wrote: > Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> > --- > linux-user/qemu.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-trivial] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h 2016-03-23 18:32 [Qemu-trivial] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h Md Haris Iqbal ` (2 preceding siblings ...) 2016-05-05 17:26 ` Stefan Hajnoczi @ 2016-09-14 7:24 ` Michael Tokarev 3 siblings, 0 replies; 10+ messages in thread From: Michael Tokarev @ 2016-09-14 7:24 UTC (permalink / raw) To: Md Haris Iqbal, qemu-devel; +Cc: qemu-trivial 23.03.2016 21:32, Md Haris Iqbal wrote: > Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com> > --- > linux-user/qemu.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/linux-user/qemu.h b/linux-user/qemu.h > index 26b0ba2..3c3fd15 100644 > --- a/linux-user/qemu.h > +++ b/linux-user/qemu.h > @@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy > #ifdef DEBUG_REMAP > { > void *addr; > - addr = malloc(len); > + addr = g_malloc(len); > if (copy) > memcpy(addr, g2h(guest_addr), len); > else > @@ -407,7 +407,7 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, > return; > if (len > 0) > memcpy(g2h(guest_addr), host_ptr, len); > - free(host_ptr); > + g_free(host_ptr); > #endif > } This is a very old patch, somehow missed by me at that time. Applied to -trivial now, thank you! /mjt ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-09-14 7:25 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-03-23 18:32 [Qemu-trivial] [Qemu-Devel] [PATCH] Changed malloc to g_malloc, free to g_free in linux-user/qemu.h Md Haris Iqbal 2016-03-29 15:53 ` haris iqbal 2016-03-30 14:06 ` haris iqbal 2016-03-30 14:09 ` [Qemu-trivial] [Qemu-devel] " Stefan Hajnoczi 2016-03-30 16:28 ` haris iqbal 2016-03-31 9:42 ` Stefan Hajnoczi 2016-03-31 10:57 ` haris iqbal 2016-05-03 9:47 ` haris iqbal 2016-05-05 17:26 ` Stefan Hajnoczi 2016-09-14 7:24 ` [Qemu-trivial] " Michael Tokarev
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).