Skip to content

Commit

Permalink
tracing: fix printk format specifier
Browse files Browse the repository at this point in the history
Impact: clean up

The offsetof and sizeof are of type size_t, and instead of typecasting
them to unsigned int for printk formatting, one could just use %zu.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
  • Loading branch information
Steven Rostedt committed Mar 10, 2009
1 parent 157587d commit ce8eb2b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,20 +338,19 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,

#undef FIELD
#define FIELD(type, name) \
#type, #name, (unsigned int)offsetof(typeof(field), name), \
(unsigned int)sizeof(field.name)
#type, #name, offsetof(typeof(field), name), sizeof(field.name)

static int trace_write_header(struct trace_seq *s)
{
struct trace_entry field;

/* struct trace_entry */
return trace_seq_printf(s,
"\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
"\n",
FIELD(unsigned char, type),
FIELD(unsigned char, flags),
Expand Down

0 comments on commit ce8eb2b

Please sign in to comment.