[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110524.035801.1555795213632087107.davem@davemloft.net>
Date: Tue, 24 May 2011 03:58:01 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: joe@...ches.com, mingo@...e.hu, akpm@...ux-foundation.org,
netdev@...r.kernel.org, drosenberg@...curity.com,
a.p.zijlstra@...llo.nl, eparis@...isplace.org,
eugeneteo@...nel.org, jmorris@...ei.org, kees.cook@...onical.com,
tgraf@...radead.org
Subject: Re: [patch 1/1] net: convert %p usage to %pK
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Tue, 24 May 2011 09:45:01 +0200
> Le mardi 24 mai 2011 à 00:35 -0700, Joe Perches a écrit :
>
>> I think it's be better without the casts
>> using the standard kernel.h macros.
>>
>> void *ptr;
>>
>> ptr = maybe_hide_ptr(sk);
>> r->id.idiag_cookie[0] = lower_32_bits(ptr);
>> r->id.idiag_cookie[1] = upper_32_bits(ptr);
>>
>
> I am not sure I want to patch lower_32_bits() and upper_32_bits() for
> this.
>
> They dont work on pointers, but on "numbers", according to kerneldoc
> Andrew wrote years ago. gcc agrees :
>
> net/ipv4/inet_diag.c: In function ‘inet_csk_diag_fill’:
> net/ipv4/inet_diag.c:119: warning: cast from pointer to integer of different size
> net/ipv4/inet_diag.c:120: error: invalid operands to binary >>
> make[1]: *** [net/ipv4/inet_diag.o] Error 1
Also you can't do this, the "cookie" is used by the kernel future
lookups to find sockets.
The kernel pointer is part of the API, so sorry you can't "hide"
kernel pointers in this case without really breaking user visible
things.
Powered by blists - more mailing lists