Re: [PATCH] creds: suppress warning in get_cred

From: Hannes Eder
Date: Mon Jan 19 2009 - 09:59:24 EST


On Mon, Jan 19, 2009 at 3:52 PM, Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
> Hi David,
>
> On Mon, 19 Jan 2009 12:29:31 +0000 David Howells <dhowells@xxxxxxxxxx> wrote:
>>
>> Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>>
>> > + return get_new_cred((struct cred *)(uintptr_t)cred);
>>
>> That should probably be 'unsigned long' within the kernel. This is also a
>> compiler bug, but I think we can live with this fix.
>
> We do have uintptr_t inside the kernel (it is typedeffed to unsigned
> long) but I used it explicitly because its type is defined to be large
> enough to store any pointer.

When working around this compiler bug would it be better to do it like this:

+ return get_new_cred((struct cred *)(void *)cred);

instead of relying on the size of a pointer and using an large enough
integer data type?

Maybe would should just add a comment, to note that if such a warning
is issued, that
this is a compiler bug.

Or disable the warning for this region, but as far as I know gcc _does
not_ have this feature yet.

> However, I have also verified that using a newer compiler (4.3.2 in my
> case) makes the warning go away as Hannes Eder pointed out when
> mentioning his earlier patch.

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