Re: [PATCH] use %pK for /proc/kallsyms and /proc/modules

From: Joe Perches
Date: Wed Jan 26 2011 - 19:15:18 EST


On Tue, 2011-01-25 at 10:10 -0800, Kees Cook wrote:
> Note that when compiling with -Wformat, these harmless warnings will
> be emitted, and can be ignored:
> warning: '0' flag used with â%pâ gnu_printf format

> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
[]
> @@ -477,11 +477,11 @@ static int s_show(struct seq_file *m, void *p)
> */
> type = iter->exported ? toupper(iter->type) :
> tolower(iter->type);
> - seq_printf(m, "%0*lx %c %s\t[%s]\n",
> + seq_printf(m, "%0*pK %c %s\t[%s]\n",
> (int)(2 * sizeof(void *)),
> iter->value, type, iter->name, iter->module_name);

You can change this to

seq_printf(m, "%pK %c %s\t[%s]\n",
iter->value, type, iter->name, iter->module_name);

as that's the normal size.

Presto. No warnings. Same output.

> } else
> - seq_printf(m, "%0*lx %c %s\n",
> + seq_printf(m, "%0*pK %c %s\n",
> (int)(2 * sizeof(void *)),

Here too.

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