QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread
@ 2020-07-31  5:06 Lukas Straub
  2020-07-31  8:36 ` Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Lukas Straub @ 2020-07-31  5:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Jason Wang, Zhang Chen


[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

s->iothread is checked for NULL on object creation in colo_compare_complete,
so it's guaranteed not to be NULL.
This resolves a false alert from Coverity (CID 1429969).

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
---
 net/colo-compare.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/colo-compare.c b/net/colo-compare.c
index cc15f23dea..2c20de1537 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -1442,9 +1442,7 @@ static void colo_compare_finalize(Object *obj)
         qemu_chr_fe_deinit(&s->chr_notify_dev, false);
     }
 
-    if (s->iothread) {
-        colo_compare_timer_del(s);
-    }
+    colo_compare_timer_del(s);
 
     qemu_bh_delete(s->event_bh);
 
@@ -1470,9 +1468,7 @@ static void colo_compare_finalize(Object *obj)
         g_hash_table_destroy(s->connection_track_table);
     }
 
-    if (s->iothread) {
-        object_unref(OBJECT(s->iothread));
-    }
+    object_unref(OBJECT(s->iothread));
 
     g_free(s->pri_indev);
     g_free(s->sec_indev);
-- 
2.20.1

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread
  2020-07-31  5:06 [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread Lukas Straub
@ 2020-07-31  8:36 ` Philippe Mathieu-Daudé
  2020-07-31 10:26 ` Li Qiang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-31  8:36 UTC (permalink / raw)
  To: Lukas Straub, qemu-devel; +Cc: Peter Maydell, Jason Wang, Zhang Chen

On 7/31/20 7:06 AM, Lukas Straub wrote:
> s->iothread is checked for NULL on object creation in colo_compare_complete,
> so it's guaranteed not to be NULL.
> This resolves a false alert from Coverity (CID 1429969).
> 
> Signed-off-by: Lukas Straub <lukasstraub2@web.de>

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

> ---
>  net/colo-compare.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index cc15f23dea..2c20de1537 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -1442,9 +1442,7 @@ static void colo_compare_finalize(Object *obj)
>          qemu_chr_fe_deinit(&s->chr_notify_dev, false);
>      }
>  
> -    if (s->iothread) {
> -        colo_compare_timer_del(s);
> -    }
> +    colo_compare_timer_del(s);
>  
>      qemu_bh_delete(s->event_bh);
>  
> @@ -1470,9 +1468,7 @@ static void colo_compare_finalize(Object *obj)
>          g_hash_table_destroy(s->connection_track_table);
>      }
>  
> -    if (s->iothread) {
> -        object_unref(OBJECT(s->iothread));
> -    }
> +    object_unref(OBJECT(s->iothread));
>  
>      g_free(s->pri_indev);
>      g_free(s->sec_indev);
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread
  2020-07-31  5:06 [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread Lukas Straub
  2020-07-31  8:36 ` Philippe Mathieu-Daudé
@ 2020-07-31 10:26 ` Li Qiang
  2020-07-31 10:32 ` Zhang, Chen
  2020-08-04  6:03 ` Jason Wang
  3 siblings, 0 replies; 5+ messages in thread
From: Li Qiang @ 2020-07-31 10:26 UTC (permalink / raw)
  To: Lukas Straub; +Cc: Peter Maydell, Jason Wang, qemu-devel, Zhang Chen

Lukas Straub <lukasstraub2@web.de> 于2020年7月31日周五 下午1:09写道:
>
> s->iothread is checked for NULL on object creation in colo_compare_complete,
> so it's guaranteed not to be NULL.
> This resolves a false alert from Coverity (CID 1429969).
>
> Signed-off-by: Lukas Straub <lukasstraub2@web.de>

Reviewed-by: Li Qiang <liq3ea@gmail.com>

> ---
>  net/colo-compare.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index cc15f23dea..2c20de1537 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -1442,9 +1442,7 @@ static void colo_compare_finalize(Object *obj)
>          qemu_chr_fe_deinit(&s->chr_notify_dev, false);
>      }
>
> -    if (s->iothread) {
> -        colo_compare_timer_del(s);
> -    }
> +    colo_compare_timer_del(s);
>
>      qemu_bh_delete(s->event_bh);
>
> @@ -1470,9 +1468,7 @@ static void colo_compare_finalize(Object *obj)
>          g_hash_table_destroy(s->connection_track_table);
>      }
>
> -    if (s->iothread) {
> -        object_unref(OBJECT(s->iothread));
> -    }
> +    object_unref(OBJECT(s->iothread));
>
>      g_free(s->pri_indev);
>      g_free(s->sec_indev);
> --
> 2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread
  2020-07-31  5:06 [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread Lukas Straub
  2020-07-31  8:36 ` Philippe Mathieu-Daudé
  2020-07-31 10:26 ` Li Qiang
@ 2020-07-31 10:32 ` Zhang, Chen
  2020-08-04  6:03 ` Jason Wang
  3 siblings, 0 replies; 5+ messages in thread
From: Zhang, Chen @ 2020-07-31 10:32 UTC (permalink / raw)
  To: Lukas Straub, qemu-devel; +Cc: Peter Maydell, Jason Wang



> -----Original Message-----
> From: Lukas Straub <lukasstraub2@web.de>
> Sent: Friday, July 31, 2020 1:06 PM
> To: qemu-devel <qemu-devel@nongnu.org>
> Cc: Peter Maydell <peter.maydell@linaro.org>; Jason Wang
> <jasowang@redhat.com>; Zhang, Chen <chen.zhang@intel.com>
> Subject: [PATCH] colo-compare: Remove superfluous NULL-pointer checks
> for s->iothread
> 
> s->iothread is checked for NULL on object creation in
> s->colo_compare_complete,
> so it's guaranteed not to be NULL.
> This resolves a false alert from Coverity (CID 1429969).
> 

Reviewed-by: Zhang Chen <chen.zhang@intel.com>

> Signed-off-by: Lukas Straub <lukasstraub2@web.de>
> ---
>  net/colo-compare.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/net/colo-compare.c b/net/colo-compare.c index
> cc15f23dea..2c20de1537 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -1442,9 +1442,7 @@ static void colo_compare_finalize(Object *obj)
>          qemu_chr_fe_deinit(&s->chr_notify_dev, false);
>      }
> 
> -    if (s->iothread) {
> -        colo_compare_timer_del(s);
> -    }
> +    colo_compare_timer_del(s);
> 
>      qemu_bh_delete(s->event_bh);
> 
> @@ -1470,9 +1468,7 @@ static void colo_compare_finalize(Object *obj)
>          g_hash_table_destroy(s->connection_track_table);
>      }
> 
> -    if (s->iothread) {
> -        object_unref(OBJECT(s->iothread));
> -    }
> +    object_unref(OBJECT(s->iothread));
> 
>      g_free(s->pri_indev);
>      g_free(s->sec_indev);
> --
> 2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread
  2020-07-31  5:06 [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread Lukas Straub
                   ` (2 preceding siblings ...)
  2020-07-31 10:32 ` Zhang, Chen
@ 2020-08-04  6:03 ` Jason Wang
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2020-08-04  6:03 UTC (permalink / raw)
  To: Lukas Straub, qemu-devel; +Cc: Peter Maydell, Zhang Chen


On 2020/7/31 下午1:06, Lukas Straub wrote:
> s->iothread is checked for NULL on object creation in colo_compare_complete,
> so it's guaranteed not to be NULL.
> This resolves a false alert from Coverity (CID 1429969).
>
> Signed-off-by: Lukas Straub <lukasstraub2@web.de>
> ---
>   net/colo-compare.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index cc15f23dea..2c20de1537 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -1442,9 +1442,7 @@ static void colo_compare_finalize(Object *obj)
>           qemu_chr_fe_deinit(&s->chr_notify_dev, false);
>       }
>   
> -    if (s->iothread) {
> -        colo_compare_timer_del(s);
> -    }
> +    colo_compare_timer_del(s);
>   
>       qemu_bh_delete(s->event_bh);
>   
> @@ -1470,9 +1468,7 @@ static void colo_compare_finalize(Object *obj)
>           g_hash_table_destroy(s->connection_track_table);
>       }
>   
> -    if (s->iothread) {
> -        object_unref(OBJECT(s->iothread));
> -    }
> +    object_unref(OBJECT(s->iothread));
>   
>       g_free(s->pri_indev);
>       g_free(s->sec_indev);


Applied.

Thanks



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31  5:06 [PATCH] colo-compare: Remove superfluous NULL-pointer checks for s->iothread Lukas Straub
2020-07-31  8:36 ` Philippe Mathieu-Daudé
2020-07-31 10:26 ` Li Qiang
2020-07-31 10:32 ` Zhang, Chen
2020-08-04  6:03 ` Jason Wang

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git