Re: [PATCH] lib: vsprintf: Add %pa format specifier for phys_addr_t types

Joe Perches
2013-01-22T07:52:32Z

On Tue, 2013-01-22 at 09:29 +0200, Andy Shevchenko wrote:
> On Mon, 2013-01-21 at 21:47 -0800, Stepan Moskovchenko wrote:
> > Add the %pa format specifier for printing a phys_addr_t
> > type, since the physical address size on some platforms
> > can vary based on build options, regardless of the native
> > integer type.
[]
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
[]
> @@ -1112,6 +1113,12 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> > return netdev_feature_string(buf, end, ptr, spec);
> > }
> > break;
> > + case 'a':
> > + spec.flags |= SPECIAL | SMALL | ZEROPAD;
> > + spec.field_width = sizeof(phys_addr_t) * 2;

I believe this should be:

spec.field_width = sizeof(phys_addr_t) * 2 + 2;