Ulrich Kunitz wrote:
> the clearing is definitely not in the performance-critical path
> and is definitely faster then 10 milliseconds. On most
> architectures is not even a function call. What I want to prevent
> is the usage of structures, after they have cleared. A cleaned
> structure will result in zero pointer exceptions and other errors,
> which are easy to understand. It is much more difficult to detect
> those errors with a fully initialized structure, which is just
> deallocated. Most malloc-debuggers support poisoning and zeroing a
> structure is a kind of poisoning and there is not a lot of penalty
> we pay for it.

I just meant that I couldn't see the point in it (wasn't suggesting it 
had any performance implications). Thanks for the explanation, if you 
think it will actually be useful one day then I'm happy to leave it.

> Regarding the locks in zd_mac_clean(), yes I would agree there is
> no point in having those locks, if the data would not be cleared.
> But if we clear the structure, than we should protect it and don't
> make any assumptions about the code path.

My only concern about this approach is that the locking in the 
disconnect path may *hide* race conditions to a certain extent. The 
races would still happen, we'd still see use-after-free, but they might 
be less obvious unless caught early. Still, I guess that any races here 
are unlikely.

Daniel



_______________________________________________
Zd1211-devs mailing list - http://zd1211.ath.cx/
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs

Reply via email to