[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51F33AC9.3040603@huawei.com>
Date: Sat, 27 Jul 2013 11:13:13 +0800
From: Li Zefan <lizefan@...wei.com>
To: Steven Rostedt <rostedt@...dmis.org>
CC: Frederic Weisbecker <fweisbec@...il.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2][RESEND] tracing: Shrink the size of struct ftrace_event_field
>> @@ -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.
>
Changing field->is_signed to bool won't shrink the size of the struct.
I prefer: field->is_signed = !!is_signed.
>>
>> + 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.
>
oops.
> We should make a helper macro:
>
> #define VERIFY_SIZE(type) WARN_ON(type > field->type)
>
Much better!
> and then have:
>
> VERIFY_SIZE(offset);
> VERIFY_SIZE(size);
> VERIFY_SIZE(filter_type);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists