Ingo Oeser <[EMAIL PROTECTED]> writes:

> Hi,
>
> On Monday, 1. January 2007 07:37, Amit Choudhary wrote:
>> --- Ingo Oeser <[EMAIL PROTECTED]> wrote:
>> > #define kfree_nullify(x) do { \
>> >    if (__builtin_constant_p(x)) { \
>> >            kfree(x); \
>> >    } else { \
>> >            typeof(x) *__addr_x = &x; \
>
> Ok, I should change that line to 
>               typeof(x) *__addr_x = &(x); \
>
>> >            kfree(*__addr_x); \
>> >            *__addr_x = NULL; \
>> >    } \
>> > } while (0)
>> > 
>> > Regards
>> > 
>> > Ingo Oeser
>> > 
>> 
>> This is a nice approach but what if someone does kfree_nullify(x+20).
>
> Then this works, because the side effect (+20) is evaluated only once. 

It's not a side effect, it's a non-lvalue, and you can't take the address
of a non-lvalue.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to