Re: [PATCH V2 1/4] perf: Add hardware breakpoint address mask

From: Oleg Nesterov
Date: Tue Apr 23 2013 - 09:21:59 EST


On 04/23, Jacob Shin wrote:
>
> +__weak int arch_validate_hwbkpt_addr_mask(struct perf_event *bp)
> +{
> + return bp->attr.bp_addr_mask == 0;
> +}
> +
> static int validate_hw_breakpoint(struct perf_event *bp)
> {
> int ret;
> @@ -393,6 +398,10 @@ static int validate_hw_breakpoint(struct perf_event *bp)
> if (ret)
> return ret;
>
> + ret = arch_validate_hwbkpt_addr_mask(bp);
> + if (ret)
> + return ret;

Well, this looks obviously wrong?

arch_validate_hwbkpt_addr_mask() fails if bp_addr_mask == 0? and returns
"1" as the error code.

Either it should returns something like "bp_addr_mask ? -ENOTSUPP : 0"
or the caller should do "if (!validate_hw_breakpoint()) return -ERR".

Oleg.

--
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/