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

Tom Gundersen teg at jklm.no
Tue Sep 16 11:25:55 PDT 2014


Applied.

Thanks!

Tom

On Tue, Sep 16, 2014 at 7:40 PM, Andreas Henriksson <andreas at fatal.se> 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 at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list