diff mbox series

[1/1] Change the order of g_free(info) and tracepoint

Message ID 1604669964-27222-1-git-send-email-kwankhede@nvidia.com (mailing list archive)
State New, archived
Headers show
Series [1/1] Change the order of g_free(info) and tracepoint | expand

Commit Message

Kirti Wankhede Nov. 6, 2020, 1:39 p.m. UTC
Fixes Coverity issue:
CID 1436126:  Memory - illegal accesses  (USE_AFTER_FREE)

Fixes: a9e271ec9b36 ("vfio: Add migration region initialization and finalize
function")

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
---
 hw/vfio/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Edmondson Nov. 6, 2020, 3:59 p.m. UTC | #1
On Friday, 2020-11-06 at 19:09:24 +0530, Kirti Wankhede wrote:

> Fixes Coverity issue:
> CID 1436126:  Memory - illegal accesses  (USE_AFTER_FREE)
>
> Fixes: a9e271ec9b36 ("vfio: Add migration region initialization and finalize
> function")
>
> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>

Maybe "fix use after free in vfio_migration_probe" as a summary?

Reviewed-by: David Edmondson <dme@dme.org>

> ---
>  hw/vfio/migration.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index 3ce285ea395d..55261562d4f3 100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -897,8 +897,8 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
>          goto add_blocker;
>      }
>  
> -    g_free(info);
>      trace_vfio_migration_probe(vbasedev->name, info->index);
> +    g_free(info);
>      return 0;
>  
>  add_blocker:
> -- 
> 2.7.0

dme.
Alex Bennée Nov. 6, 2020, 4:44 p.m. UTC | #2
Kirti Wankhede <kwankhede@nvidia.com> writes:

> Fixes Coverity issue:
> CID 1436126:  Memory - illegal accesses  (USE_AFTER_FREE)
>
> Fixes: a9e271ec9b36 ("vfio: Add migration region initialization and finalize
> function")
>
> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Philippe Mathieu-Daudé Nov. 6, 2020, 4:57 p.m. UTC | #3
On 11/6/20 4:59 PM, David Edmondson wrote:
> On Friday, 2020-11-06 at 19:09:24 +0530, Kirti Wankhede wrote:
> 
>> Fixes Coverity issue:
>> CID 1436126:  Memory - illegal accesses  (USE_AFTER_FREE)
>>
>> Fixes: a9e271ec9b36 ("vfio: Add migration region initialization and finalize
>> function")
>>
>> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> 
> Maybe "fix use after free in vfio_migration_probe" as a summary?

Yes please :)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
> Reviewed-by: David Edmondson <dme@dme.org>
> 
>> ---
>>  hw/vfio/migration.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
>> index 3ce285ea395d..55261562d4f3 100644
>> --- a/hw/vfio/migration.c
>> +++ b/hw/vfio/migration.c
>> @@ -897,8 +897,8 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
>>          goto add_blocker;
>>      }
>>  
>> -    g_free(info);
>>      trace_vfio_migration_probe(vbasedev->name, info->index);
>> +    g_free(info);
>>      return 0;
>>  
>>  add_blocker:
>> -- 
>> 2.7.0
> 
> dme.
>
diff mbox series

Patch

diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 3ce285ea395d..55261562d4f3 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -897,8 +897,8 @@  int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
         goto add_blocker;
     }
 
-    g_free(info);
     trace_vfio_migration_probe(vbasedev->name, info->index);
+    g_free(info);
     return 0;
 
 add_blocker: