}
static noinline_for_stack
-char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec,
- const char *fmt)
+char *hex_string(struct printf_state *ps, u8 *addr)
{
int i, len = 1; /* if we pass '%ph[CDN]', field width remains
negative value, fallback to the default */
char separator;
- if (spec.field_width == 0)
+ if (ps->spec.field_width == 0)
/* nothing to print */
- return buf;
+ return ps->buf;
- if (ZERO_OR_NULL_PTR(addr))
+ if (ZERO_OR_NULL_PTR(addr)) {
/* NULL pointer */
- return string(buf, end, NULL, spec);
+ printf_string(ps, NULL);
+ return ps->buf;
+ }
- switch (fmt[1]) {
+ switch (ps->fmt[1]) {
case 'C':
separator = ':';
break;
break;
}
- if (spec.field_width > 0)
- len = min_t(int, spec.field_width, 64);
+ if (ps->spec.field_width > 0)
+ len = min_t(int, ps->spec.field_width, 64);
for (i = 0; i < len; ++i) {
- if (buf < end)
- *buf = hex_asc_hi(addr[i]);
- ++buf;
- if (buf < end)
- *buf = hex_asc_lo(addr[i]);
- ++buf;
+ if (ps->buf < ps->end)
+ *ps->buf = hex_asc_hi(addr[i]);
+ ++ps->buf;
+ if (ps->buf < ps->end)
+ *ps->buf = hex_asc_lo(addr[i]);
+ ++ps->buf;
if (separator && i != len - 1) {
- if (buf < end)
- *buf = separator;
- ++buf;
+ if (ps->buf < ps->end)
+ *ps->buf = separator;
+ ++ps->buf;
}
}
- return buf;
+ return ps->buf;
}
static noinline_for_stack
case 'r':
return resource_string(ps, ptr);
case 'h':
- return hex_string(buf, end, ptr, spec, fmt);
+ return hex_string(ps, ptr);
case 'b':
switch (fmt[1]) {
case 'l':