kallsyms: take advantage of the new '%px' format

The conditional kallsym hex printing used a special fixed-width '%lx'
output (KALLSYM_FMT) in preparation for the hashing of %p, but that
series ended up adding a %px specifier to help with the conversions.

Use it, and avoid the "print pointer as an unsigned long" code.

Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Linus Torvalds 2017-11-29 10:30:13 -08:00
commit 668533dc07
3 changed files with 7 additions and 13 deletions

View file

@ -614,14 +614,14 @@ static void s_stop(struct seq_file *m, void *p)
static int s_show(struct seq_file *m, void *p)
{
unsigned long value;
void *value;
struct kallsym_iter *iter = m->private;
/* Some debugging symbols have no name. Ignore them. */
if (!iter->name[0])
return 0;
value = iter->show_value ? iter->value : 0;
value = iter->show_value ? (void *)iter->value : NULL;
if (iter->module_name[0]) {
char type;
@ -632,10 +632,10 @@ static int s_show(struct seq_file *m, void *p)
*/
type = iter->exported ? toupper(iter->type) :
tolower(iter->type);
seq_printf(m, KALLSYM_FMT " %c %s\t[%s]\n", value,
seq_printf(m, "%px %c %s\t[%s]\n", value,
type, iter->name, iter->module_name);
} else
seq_printf(m, KALLSYM_FMT " %c %s\n", value,
seq_printf(m, "%px %c %s\n", value,
iter->type, iter->name);
return 0;
}