]> git.michaelhowe.org Git - packages/o/openafs.git/commit
STABLE12-viced-malloc-dont-make-assumptions-about-the-compiler-20020524
authorDerrick Brashear <shadow@dementia.org>
Sat, 8 Jun 2002 01:17:31 +0000 (01:17 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 8 Jun 2002 01:17:31 +0000 (01:17 +0000)
commite601775d556e36708c79a2c35d54f7a4df5434c8
tree559552eb2fb0d922a3708cb5e421b4ef7e56a858
parent4abb7b6d50131f76e2be39626c6b9b4c168491b8
STABLE12-viced-malloc-dont-make-assumptions-about-the-compiler-20020524

based on report from lha@stacken.kth.se
"identP = (struct Identity *)malloc(1);

This can't be right, there should not be an assumption how the
c-compiler will lay out code. I find it acceptable to do something like this

           /* sizeof valid + offset of valid. */
           i.. = malloc(sizeof(identP->valid) + (int)&(((struct Identity *)0)->valid));

But then, why not just allocate a whole identP and be happy. A afsUUID
is not that bloted (16 bytes) so I can't see why way this is
chosen. 20 bytes will probably be allocated on 32 bit platforms for
the whole struct Identity."

(cherry picked from commit bbab90943637385742923c8bebebdd750a283e5c)
src/viced/host.c