early_initcall(initialize_ptr_random);
/* Maps a pointer to a 32 bit unique identifier. */
-static char *ptr_to_id(char *buf, char *end, const void *ptr,
- struct printf_spec spec)
+static char *ptr_to_id(struct printf_state *ps, const void *ptr)
{
const char *str = sizeof(ptr) == 8 ? "(____ptrval____)" : "(ptrval)";
unsigned long hashval;
/* When debugging early boot use non-cryptographically secure hash. */
if (unlikely(debug_boot_weak_hash)) {
hashval = hash_long((unsigned long)ptr, 32);
- return pointer_string(buf, end, (const void *)hashval, spec);
+ return pointer_string(ps->buf, ps->end, (const void *)hashval,
+ ps->spec);
}
if (static_branch_unlikely(¬_filled_random_ptr_key)) {
- spec.field_width = 2 * sizeof(ptr);
+ ps->spec.field_width = 2 * sizeof(ptr);
/* string length must be less than default_width */
- return string(buf, end, str, spec);
+ printf_string(ps, str);
+ return ps->buf;
}
#ifdef CONFIG_64BIT
#else
hashval = (unsigned long)siphash_1u32((u32)ptr, &ptr_key);
#endif
- return pointer_string(buf, end, (const void *)hashval, spec);
+ return pointer_string(ps->buf, ps->end, (const void *)hashval,
+ ps->spec);
}
static noinline_for_stack
size = sizeof(netdev_features_t);
break;
default:
- return ptr_to_id(ps->buf, ps->end, addr, ps->spec);
+ return ptr_to_id(ps, addr);
}
return special_hex_number(ps, num, size);
printf_string(ps, __clk_get_name(clk));
return ps->buf;
#else
- return ptr_to_id(ps->buf, ps->end, clk, ps->spec);
+ return ptr_to_id(ps, clk);
#endif
}
}
}
/* default is to _not_ leak addresses, hash before printing */
- return ptr_to_id(buf, end, ptr, spec);
+ return ptr_to_id(ps, ptr);
}
void printf_pointer(struct printf_state *ps, void *ptr)