On Thu, 2013-07-25 at 10:28 +0800, Li Zefan wrote:
>  
>  struct event_filter {
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 53582e9..67aee85 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -111,6 +111,11 @@ static int __trace_define_field(struct list_head *head, 
> const char *type,
>       field->size = size;
>       field->is_signed = is_signed;

I think we should just change is_signed to bool. At least the parameter.
Or we can make the assignment: field->is_signed = !!is_signed; and nuke
the check below.

>  
> +     WARN_ON(offset >= (1 << 12));
> +     WARN_ON(size >= (1 << 12));
> +     WARN_ON(is_signed >= (1 << 1));
> +     WARN_ON(field->filter_type >= (1 << 4));

Note, the test for field->filter_type is wrong.

We should make a helper macro:

#define VERIFY_SIZE(type) WARN_ON(type > field->type)

and then have:

        VERIFY_SIZE(offset);
        VERIFY_SIZE(size);
        VERIFY_SIZE(filter_type);

-- Steve

> +
>       list_add(&field->link, head);
>  
>       return 0;
> -- 1.8.0.2


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

Reply via email to