Re: [PATCH V6 02/25] perf evlist: Add initial support for mmapping an AUX area buffer

From: Jiri Olsa
Date: Tue Mar 24 2015 - 07:08:08 EST


On Mon, Mar 16, 2015 at 02:41:24PM +0200, Adrian Hunter wrote:

SNIP

> +#include <linux/bitops.h>
> +#include <linux/log2.h>
> +
> +#include "../perf.h"
> +#include "util.h"
> +#include "evlist.h"
> +#include "cpumap.h"
> +#include "thread_map.h"
> +#include "auxtrace.h"
> +
> +int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
> + struct auxtrace_mmap_params *mp,
> + void *userpg, int fd)
> +{
> +#if BITS_PER_LONG != 64 && !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
> + pr_err("Cannot use AUX area tracing mmaps\n");
> + return -1;
> +#endif
> +
> + mm->userpg = userpg;
> + mm->mask = mp->mask;
> + mm->len = mp->len;
> + mm->prev = 0;
> + mm->idx = mp->idx;
> + mm->tid = mp->tid;
> + mm->cpu = mp->cpu;
> +
> + if (!mp->len) {
> + mm->base = NULL;

is it just for safety, or could mm->base be != NULL in here?
maybe good place to use WARN_ON check?

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/