Re: [RESEND PATCH 0/2] Make functions of dev_<level> macros,recursive vsnprintf

From: Joe Perches
Date: Sat Mar 06 2010 - 17:31:05 EST


On Sat, 2010-03-06 at 14:03 -0800, Linus Torvalds wrote:
> On Sat, 6 Mar 2010, Joe Perches wrote:
> > Is that an ack, a nack or a get the hell out?
> It's mostly an Ack. I think the concept is great. I'd love to have some
> way to limit recursion,

Maybe limit the %pV recursion depth to 1 with something like:
(in vsprintf.c: pointer() )

case 'V': {
char *rtn;
static int rcount++;

if (rcount > 1) { /* Don't recurse more than once */
rcount--;
break; /* Use print the pointer */
}
rtn = buf + vsnprintf(buf, end - buf,
((struct va_format *)ptr)->fmt,
*(((struct va_format *)ptr)->va));
rcount--;
return rtn;
}

> and I'd also love to see some actual numbers of
> how deep the vsnprintf stack frame is, but I don't see how to do the
> first, and I'm hoping the second isn't too horrible.

I believe it's the arguments, a long long, a couple of pointers,
and a struct printf_spec. Not too bad.

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