Revision e0fa7ab42232e742dcb3de9f3c1f6127b5adc019 authored by Riccardo Mancini on 15 July 2021, 16:07:25 UTC, committed by Arnaldo Carvalho de Melo on 18 July 2021, 12:27:37 UTC
ASan reports some memory leaks when running:

  # perf test "42: BPF filter"

This second leak is caused by a strlist not being dellocated on error
inside probe_file__del_events.

This patch adds a goto label before the deallocation and makes the error
path jump to it.

Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Fixes: e7895e422e4da63d ("perf probe: Split del_perf_probe_events()")
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/174963c587ae77fa108af794669998e4ae558338.1626343282.git.rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 937654c
Raw File
misc.c
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include "ubifs.h"

/* Normal UBIFS messages */
void ubifs_msg(const struct ubifs_info *c, const char *fmt, ...)
{
	struct va_format vaf;
	va_list args;

	va_start(args, fmt);

	vaf.fmt = fmt;
	vaf.va = &args;

	pr_notice("UBIFS (ubi%d:%d): %pV\n",
		  c->vi.ubi_num, c->vi.vol_id, &vaf);

	va_end(args);
}								    \

/* UBIFS error messages */
void ubifs_err(const struct ubifs_info *c, const char *fmt, ...)
{
	struct va_format vaf;
	va_list args;

	va_start(args, fmt);

	vaf.fmt = fmt;
	vaf.va = &args;

	pr_err("UBIFS error (ubi%d:%d pid %d): %ps: %pV\n",
	       c->vi.ubi_num, c->vi.vol_id, current->pid,
	       __builtin_return_address(0),
	       &vaf);

	va_end(args);
}								    \

/* UBIFS warning messages */
void ubifs_warn(const struct ubifs_info *c, const char *fmt, ...)
{
	struct va_format vaf;
	va_list args;

	va_start(args, fmt);

	vaf.fmt = fmt;
	vaf.va = &args;

	pr_warn("UBIFS warning (ubi%d:%d pid %d): %ps: %pV\n",
		c->vi.ubi_num, c->vi.vol_id, current->pid,
		__builtin_return_address(0),
		&vaf);

	va_end(args);
}

static char *assert_names[] = {
	[ASSACT_REPORT] = "report",
	[ASSACT_RO] = "read-only",
	[ASSACT_PANIC] = "panic",
};

const char *ubifs_assert_action_name(struct ubifs_info *c)
{
	return assert_names[c->assert_action];
}
back to top