qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: dinglimin <dinglimin@cmss.chinamobile.com>
Cc: richard.henderson@linaro.org, philmd@linaro.org,
	qemu-devel@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>,
	qemu-trivial@nongnu.org
Subject: Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc
Date: Mon, 26 Feb 2024 18:02:32 +0800	[thread overview]
Message-ID: <ZdxhuN8w/wB7yZrx@intel.com> (raw)
In-Reply-To: <20240226090628.1986-1-dinglimin@cmss.chinamobile.com>

On Mon, Feb 26, 2024 at 05:06:28PM +0800, dinglimin wrote:
> Date: Mon, 26 Feb 2024 17:06:28 +0800
> From: dinglimin <dinglimin@cmss.chinamobile.com>
> 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 <dinglimin@cmss.chinamobile.com>
> ---
>  semihosting/uaccess.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Also cc Michael and qemu-trivial@nongnu.org.
I understand the simple cleanup can cc qemu-trivial@nongnu.org. ;-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> 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 *uaccess_lock_user(CPUArchState *env, target_ulong addr,
>                          target_ulong len, bool copy)
>  {
> -    void *p = malloc(len);
> +    void *p = g_try_malloc(len);
>      if (p && copy) {
>          if (cpu_memory_rw_debug(env_cpu(env), addr, p, len, 0)) {
> -            free(p);
> +            g_free(p);
>              p = NULL;
>          }
>      }
> @@ -87,5 +87,5 @@ void uaccess_unlock_user(CPUArchState *env, void *p,
>      if (len) {
>          cpu_memory_rw_debug(env_cpu(env), addr, p, len, 1);
>      }
> -    free(p);
> +    g_free(p);
>  }
> -- 
> 2.30.0.windows.2


  parent reply	other threads:[~2024-02-26  9:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26  9:06 [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc dinglimin
2024-02-26  9:48 ` Philippe Mathieu-Daudé
2024-02-26 10:03   ` Daniel P. Berrangé
2024-02-26 10:16   ` Peter Maydell
2024-02-26 10:02 ` Zhao Liu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-07-25  8:06 dinglimin
2023-07-25  8:13 ` Michael Tokarev
2023-07-25  9:00 ` dinglimin
2023-07-25  9:13   ` Michael Tokarev
2023-07-25  9:35     ` Peter Maydell
2023-07-26  4:37       ` 回复: " dinglimin
2023-07-26  9:43         ` Peter Maydell
2023-07-26 15:21           ` Richard Henderson
2023-07-27 14:56             ` Peter Maydell
2023-07-27 15:04               ` Daniel P. Berrangé
2023-07-27 16:31                 ` Richard Henderson
2023-07-28  5:12                   ` dinglimin
2023-07-28  9:35                     ` Peter Maydell
2023-07-28 10:50                       ` dinglimin
2023-07-28 11:27                         ` Peter Maydell
2023-07-28 12:16               ` Peter Maydell
2023-07-26  7:07       ` dinglimin
2023-07-25 10:57   ` dinglimin

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=ZdxhuN8w/wB7yZrx@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=dinglimin@cmss.chinamobile.com \
    --cc=mjt@tls.msk.ru \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.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).