Re: [PATCH] net: skbuff: use _RET_IP_

From: Joe Perches
Date: Fri May 31 2013 - 12:55:02 EST


On Fri, 2013-05-31 at 18:33 +0400, Sergei Shtylyov wrote:
> On 31-05-2013 9:20, Joe Perches wrote:
> > Don't use a standalone gcc compiled program to
> > determine what the kernel outputs.
[]
> > The kernel output is;
>
> > printk("0x%lx\n", 0x100ul) 0x100
> > printk("%p\n", (void *)0x100ul) 00000100
> > printk("%#p\n", (void *)0x100ul) 0x00000100
>
> > The last one isn't used at all in kernel source. (gcc complains)
> > It's always "0x%p"
>
> I was talking about using "%#lx", not "%#p". I don't see it in your
> example.

"0x%lx" and "%#lx" produce the same output in the kernel.

The latter isn't used very often though.
I expect most coders don't know it exists/works.

$ git grep -E "0x%l{0,2}x" | wc -l
12542
$ git grep -E "%#l{0,2}x" | wc -l
1737

(some false positives there of course)

Also, some might expect that "%#08lx", is 10 chars wide,
but it's only 8, so maybe "0x%08lx" is better used.

The "%#08lx" width defect seems pretty common:

$ git grep -E -i "%#0(8|16)l{0,2}x" | wc -l
253


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