Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc

2024-02-26 Thread Peter Maydell
On Mon, 26 Feb 2024 at 09:49, Philippe Mathieu-Daudé wrote: > > Hi, > > On 26/2/24 10:06, dinglimin wrote: > > Signed-off-by: dinglimin > > --- > > semihosting/uaccess.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/semihosting/uaccess.c

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc

2024-02-26 Thread Daniel P . Berrangé
On Mon, Feb 26, 2024 at 10:48:14AM +0100, Philippe Mathieu-Daudé wrote: > Hi, > > On 26/2/24 10:06, dinglimin wrote: > > Signed-off-by: dinglimin > > --- > > semihosting/uaccess.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/semihosting/uaccess.c

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc

2024-02-26 Thread Zhao Liu
On Mon, Feb 26, 2024 at 05:06:28PM +0800, dinglimin wrote: > Date: Mon, 26 Feb 2024 17:06:28 +0800 > From: dinglimin > Subject: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc > X-Mailer: git-send-email 2.30.0.windows.2 > > Signed-off-by: dinglimin &g

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc

2024-02-26 Thread Philippe Mathieu-Daudé
Hi, On 26/2/24 10:06, dinglimin wrote: Signed-off-by: dinglimin --- semihosting/uaccess.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c index dc587d73bc..7788ead9b2 100644 --- a/semihosting/uaccess.c +++

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc

2024-02-26 Thread dinglimin
Signed-off-by: dinglimin --- semihosting/uaccess.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c index dc587d73bc..7788ead9b2 100644 --- a/semihosting/uaccess.c +++ b/semihosting/uaccess.c @@ -14,10 +14,10 @@ void

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-28 Thread Peter Maydell
On Thu, 27 Jul 2023 at 15:56, Peter Maydell wrote: > The only real reason is just consistency -- the project uses > the glib malloc wrappers, and in theory any use of raw > malloc() ought to be either: > * something that's third party library code (eg libdecnumber) > * because it's going into a

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-28 Thread Peter Maydell
On Fri, 28 Jul 2023 at 11:50, dinglimin wrote: > > Replaced a call to malloc() and its respective call to free() with g_malloc() > and g_free(). > > Signed-off-by: dinglimin > > v4 -> V5:Use g_try_malloc() instead of malloc() > V3 -> V4:Delete null checks after g malloc(). > V2 ->

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-28 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin v4 -> V5:Use g_try_malloc() instead of malloc() V3 -> V4:Delete null checks after g malloc(). V2 -> V3:softmmu_unlock_user changes free to g free. V1 -> V2:if

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-28 Thread Peter Maydell
On Fri, 28 Jul 2023 at 06:13, dinglimin wrote: > > Replaced a call to malloc() and its respective call to free() with g_malloc() > and g_free(). > > Signed-off-by: dinglimin > > v4 -> V5:Use g_try_malloc() instead of malloc() > V3 -> V4:Delete null checks after g malloc(). > V2 ->

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-27 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin v4 -> V5:Use g_try_malloc() instead of malloc() V3 -> V4:Delete null checks after g malloc(). V2 -> V3:softmmu_unlock_user changes free to g free. V1 -> V2:if

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-27 Thread Richard Henderson
On 7/27/23 08:04, Daniel P. Berrangé wrote: On Thu, Jul 27, 2023 at 03:56:23PM +0100, Peter Maydell wrote: On Wed, 26 Jul 2023 at 16:21, Richard Henderson wrote: On 7/26/23 02:43, Peter Maydell wrote: (Something went wrong with the quoting in your email. I've fixed it up.) On Wed, 26 Jul

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-27 Thread Daniel P . Berrangé
On Thu, Jul 27, 2023 at 03:56:23PM +0100, Peter Maydell wrote: > On Wed, 26 Jul 2023 at 16:21, Richard Henderson > wrote: > > > > On 7/26/23 02:43, Peter Maydell wrote: > > > (Something went wrong with the quoting in your email. I've > > > fixed it up.) > > > > > > On Wed, 26 Jul 2023 at 05:38,

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-27 Thread Peter Maydell
On Wed, 26 Jul 2023 at 16:21, Richard Henderson wrote: > > On 7/26/23 02:43, Peter Maydell wrote: > > (Something went wrong with the quoting in your email. I've > > fixed it up.) > > > > On Wed, 26 Jul 2023 at 05:38, wrote: > >> Peter Maydell wrote: > >>> The third part here, is that g_malloc()

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-26 Thread Richard Henderson
On 7/26/23 02:43, Peter Maydell wrote: (Something went wrong with the quoting in your email. I've fixed it up.) On Wed, 26 Jul 2023 at 05:38, wrote: Peter Maydell wrote: The third part here, is that g_malloc() does not ever fail -- it will abort() on out of memory. However the code here is

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-26 Thread Peter Maydell
(Something went wrong with the quoting in your email. I've fixed it up.) On Wed, 26 Jul 2023 at 05:38, wrote: > Peter Maydell wrote: > > The third part here, is that g_malloc() does not ever > > fail -- it will abort() on out of memory. However > > the code here is still handling g_malloc()

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-26 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin V3 -> V4:Delete null checks after g malloc(). g_malloc() is preferred more than g_try_* functions, which return NULL on error, when the size of the requested allocation is

回复: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread dinglimin
; (which we want > here, because the guest is passing us the length of memory > to try to allocate) is g_try_malloc(). > > thanks > -- PMM g_malloc() is preferred more than g_try_* functions, which return NULL on error, when the size of the requested allocation is small. This is because

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin V2 -> V3:softmmu_unlock_user changes free to g free. V1 -> V2:if cpu_memory_rw_debug failed, still need to set p=NULL --- semihosting/uaccess.c | 6 +++--- 1 file changed, 3

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread Peter Maydell
On Tue, 25 Jul 2023 at 10:13, Michael Tokarev wrote: > > 25.07.2023 12:00, dinglimin wrote: > > Replaced a call to malloc() and its respective call to free() with > > g_malloc() and g_free(). > > > > Signed-off-by: dinglimin > > > > V1 -> V2:if cpu_memory_rw_debug failed, still need to set

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread Michael Tokarev
25.07.2023 12:00, dinglimin wrote: Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin V1 -> V2:if cpu_memory_rw_debug failed, still need to set p=NULL --- semihosting/uaccess.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin V1 -> V2:if cpu_memory_rw_debug failed, still need to set p=NULL --- semihosting/uaccess.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread Michael Tokarev
25.07.2023 11:06, dinglimin wrote: Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). ... void *softmmu_lock_user(CPUArchState *env, target_ulong addr, target_ulong len, bool copy) { -void *p = malloc(len); +void

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin --- semihosting/uaccess.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c index 8018828069..8f2e6f63ee