Re: [PATCH 3/3] tracing/user_events: Prevent same address and bit per process

Steven Rostedt
2023-04-25T01:41:25Z

On Tue, 11 Apr 2023 14:17:09 -0700
Beau Belgrave <beaub@linux.microsoft.com> wrote:

> +static bool user_event_enabler_exists(struct user_event_mm *mm,
> + unsigned long uaddr, unsigned char bit)
> +{
> + struct user_event_enabler *enabler;
> + struct user_event_enabler *next;
> +
> + list_for_each_entry_safe(enabler, next, &mm->enablers, link)
> + if (enabler->addr == uaddr &&
> + (enabler->values & ENABLE_VAL_BIT_MASK) == bit)
> + return true;
> +

Please add brackets around complex calls like the above. The no bracket
rule is not if you can get away without using it, but if there's only a
single line.

list_for_each_entry_safe(enabler, next, &mm->enablers, link) {
if (enabler->addr == uaddr &&
(enabler->values & ENABLE_VAL_BIT_MASK) == bit)
return true;
}

-- Steve

> + return false;
> +}
> +