Re: [systemd-devel] [PATCH] bootchart: oom-check correct variable

2014-09-16 Thread Tom Gundersen
Applied.

Thanks!

Tom

On Tue, Sep 16, 2014 at 7:40 PM, Andreas Henriksson  wrote:
> Coverity warned that we have already dereferenced ps->sample before
> null-checking it. I suspect that's not really the issue and that
> the check is checking the wrong variable.
> Likely the oom-check should be on the just allocated ps->sample->next.
>
> Found by coverity. Fixes: CID#1237765
> ---
>  src/bootchart/store.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/bootchart/store.c b/src/bootchart/store.c
> index 2d2ea42..e6aafd8 100644
> --- a/src/bootchart/store.c
> +++ b/src/bootchart/store.c
> @@ -394,7 +394,7 @@ schedstat_next:
>  continue;
>
>  ps->sample->next = new0(struct ps_sched_struct, 1);
> -if (!ps->sample) {
> +if (!ps->sample->next) {
>  log_oom();
>  exit(EXIT_FAILURE);
>  }
> --
> 2.1.0
>
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] bootchart: oom-check correct variable

2014-09-16 Thread Andreas Henriksson
Coverity warned that we have already dereferenced ps->sample before
null-checking it. I suspect that's not really the issue and that
the check is checking the wrong variable.
Likely the oom-check should be on the just allocated ps->sample->next.

Found by coverity. Fixes: CID#1237765
---
 src/bootchart/store.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index 2d2ea42..e6aafd8 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -394,7 +394,7 @@ schedstat_next:
 continue;
 
 ps->sample->next = new0(struct ps_sched_struct, 1);
-if (!ps->sample) {
+if (!ps->sample->next) {
 log_oom();
 exit(EXIT_FAILURE);
 }
-- 
2.1.0

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel