Re: [PATCH v3] hw/cxl: Fix CFMW config memory leak

2023-09-11 Thread Jonathan Cameron via
On Fri, 8 Sep 2023 20:02:41 +0300
Michael Tokarev  wrote:

> 08.08.2023 17:44, Jonathan Cameron:
> 
> > Sorry, I'm running a bit behind.  Have this one a few other fixes
> > still queued up - I didn't consider any of them particularly critical
> > for the release so wasn't rushing.
> > 
> > I'll aim to get them out as a series soon though so they are
> > available for start of next cycle if not for slipping in before
> > the release.  
> 
> A month later, friendly ping? :)
> (this is sent to -stable too, fwiw).

https://lore.kernel.org/qemu-devel/20230904132806.6094-2-jonathan.came...@huawei.com/

Posted a series with this in last week.  Hopefully Michael will queue this
in his next pull.

Jonathan
> 
> /mjt
> 
> 




Re: [PATCH v3] hw/cxl: Fix CFMW config memory leak

2023-09-08 Thread Michael Tokarev

08.08.2023 17:44, Jonathan Cameron:


Sorry, I'm running a bit behind.  Have this one a few other fixes
still queued up - I didn't consider any of them particularly critical
for the release so wasn't rushing.

I'll aim to get them out as a series soon though so they are
available for start of next cycle if not for slipping in before
the release.


A month later, friendly ping? :)
(this is sent to -stable too, fwiw).

/mjt




Re: [PATCH v3] hw/cxl: Fix CFMW config memory leak

2023-08-08 Thread Jonathan Cameron via
On Sat, 5 Aug 2023 08:46:29 +0300
Michael Tokarev  wrote:

> 31.05.2023 14:08, Jonathan Cameron via wrote:
> > On Wed, 31 May 2023 09:51:43 +0200
> > Philippe Mathieu-Daudé  wrote:
> >   
> >> On 31/5/23 08:07, Li Zhijian wrote:  
> >>> Allocate targets and targets[n] resources when all sanity checks are
> >>> passed to avoid memory leaks.
> >>>
> >>> Suggested-by: Philippe Mathieu-Daudé 
> >>> Signed-off-by: Li Zhijian 
> >>> ---
> >>> V3: allocte further resource when we can't fail # Philippe  
> >>
> >> Thanks for the v3!
> >>
> >> Reviewed-by: Philippe Mathieu-Daudé   
> > 
> > Thanks.  I've added this near the top of my queue so will send
> > it out along with other similar fixes as a series for Michael
> > to consider picking up.  
> 
> Hi!
> 
> Has this been forgotten? Is it still needed?
> 
> /mjt
> 

Sorry, I'm running a bit behind.  Have this one a few other fixes
still queued up - I didn't consider any of them particularly critical
for the release so wasn't rushing.

I'll aim to get them out as a series soon though so they are
available for start of next cycle if not for slipping in before
the release.

Jonathan



Re: [PATCH v3] hw/cxl: Fix CFMW config memory leak

2023-08-04 Thread Michael Tokarev

31.05.2023 14:08, Jonathan Cameron via wrote:

On Wed, 31 May 2023 09:51:43 +0200
Philippe Mathieu-Daudé  wrote:


On 31/5/23 08:07, Li Zhijian wrote:

Allocate targets and targets[n] resources when all sanity checks are
passed to avoid memory leaks.

Suggested-by: Philippe Mathieu-Daudé 
Signed-off-by: Li Zhijian 
---
V3: allocte further resource when we can't fail # Philippe


Thanks for the v3!

Reviewed-by: Philippe Mathieu-Daudé 


Thanks.  I've added this near the top of my queue so will send
it out along with other similar fixes as a series for Michael
to consider picking up.


Hi!

Has this been forgotten? Is it still needed?

/mjt



Re: [PATCH v3] hw/cxl: Fix CFMW config memory leak

2023-05-31 Thread Jonathan Cameron via
On Wed, 31 May 2023 09:51:43 +0200
Philippe Mathieu-Daudé  wrote:

> On 31/5/23 08:07, Li Zhijian wrote:
> > Allocate targets and targets[n] resources when all sanity checks are
> > passed to avoid memory leaks.
> > 
> > Suggested-by: Philippe Mathieu-Daudé 
> > Signed-off-by: Li Zhijian 
> > ---
> > V3: allocte further resource when we can't fail # Philippe  
> 
> Thanks for the v3!
> 
> Reviewed-by: Philippe Mathieu-Daudé 

Thanks.  I've added this near the top of my queue so will send
it out along with other similar fixes as a series for Michael
to consider picking up.

Jonathan

> 
> > V2: Delete unnecesarry check
> > ---
> >   hw/cxl/cxl-host.c | 12 ++--
> >   1 file changed, 6 insertions(+), 6 deletions(-)  
> 




Re: [PATCH v3] hw/cxl: Fix CFMW config memory leak

2023-05-31 Thread Philippe Mathieu-Daudé

On 31/5/23 08:07, Li Zhijian wrote:

Allocate targets and targets[n] resources when all sanity checks are
passed to avoid memory leaks.

Suggested-by: Philippe Mathieu-Daudé 
Signed-off-by: Li Zhijian 
---
V3: allocte further resource when we can't fail # Philippe


Thanks for the v3!

Reviewed-by: Philippe Mathieu-Daudé 


V2: Delete unnecesarry check
---
  hw/cxl/cxl-host.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)





[PATCH v3] hw/cxl: Fix CFMW config memory leak

2023-05-31 Thread Li Zhijian
Allocate targets and targets[n] resources when all sanity checks are
passed to avoid memory leaks.

Suggested-by: Philippe Mathieu-Daudé 
Signed-off-by: Li Zhijian 
---
V3: allocte further resource when we can't fail # Philippe
V2: Delete unnecesarry check
---
 hw/cxl/cxl-host.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c
index 034c7805b3e..f0920da956d 100644
--- a/hw/cxl/cxl-host.c
+++ b/hw/cxl/cxl-host.c
@@ -39,12 +39,6 @@ static void cxl_fixed_memory_window_config(CXLState 
*cxl_state,
 return;
 }
 
-fw->targets = g_malloc0_n(fw->num_targets, sizeof(*fw->targets));
-for (i = 0, target = object->targets; target; i++, target = target->next) {
-/* This link cannot be resolved yet, so stash the name for now */
-fw->targets[i] = g_strdup(target->value);
-}
-
 if (object->size % (256 * MiB)) {
 error_setg(errp,
"Size of a CXL fixed memory window must be a multiple of 
256MiB");
@@ -64,6 +58,12 @@ static void cxl_fixed_memory_window_config(CXLState 
*cxl_state,
 fw->enc_int_gran = 0;
 }
 
+fw->targets = g_malloc0_n(fw->num_targets, sizeof(*fw->targets));
+for (i = 0, target = object->targets; target; i++, target = target->next) {
+/* This link cannot be resolved yet, so stash the name for now */
+fw->targets[i] = g_strdup(target->value);
+}
+
 cxl_state->fixed_windows = g_list_append(cxl_state->fixed_windows,
  g_steal_pointer());
 
-- 
2.31.1