tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Increase PTHREAD_KEYS_MAX (round 2)
In article <20150522145748.GA19722%homeworld.netbsd.org@localhost>,
Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:
>On Wed, May 20, 2015 at 03:11:48PM +0200, Joerg Sonnenberger wrote:
>> > http://ftp.espci.fr/shadow/manu/pthread_keys_max.patch
>> This will just overflow the pthread structure? Besides, use strtoi,
>> calloc etc.
>
>Here is an updated version using strtoll, calloc and taking care
>of struct __pthread_st integrity:
>http://ftp.espci.fr/shadow/manu/pthread_keys_max3.patch
Looks pretty good, except:
pthread_keys_max = strtol(pkm, (char **)NULL, 10);
Why cast NULL, why limit to decimal, this should be unsigned...?
Perhaps also limit it to a reasonable value.
if (pthread__tsd_list)
free(pthread__tsd_list);
No need to check for NULL before free.
pthread_keys_max = 0;
Why default to 0 on error? I would default to the current default.
long pthread_keys_max = 0;
Why initialize it, why long?
err:
Traditionally we call the bail label out, err is confusing because
it is also a function name.
Thanks,
christos
Home |
Main Index |
Thread Index |
Old Index