Home GnuPG

secmem: fix compiler warnings on ARM
99faf9cb34f8Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

secmem: fix compiler warnings on ARM

* src/secmem.c (ADDR_TO_BLOCK, mb_get_next, mb_get_new): Cast pointer
from 'char *' to 'memblock_t *' through 'void *'.
(MB_WIPE_OUT): Remove unneeded cast to 'memblock_t *'.

Patch fixes 'cast increases required alignment' warnings seen on GCC:

secmem.c: In function 'mb_get_next':
secmem.c:140:13: warning: cast increases required alignment of target type [-Wcast-align]

mb_next = (memblock_t *) ((char *) mb + BLOCK_HEAD_SIZE + mb->size);
          ^

secmem.c: In function 'mb_get_new':
secmem.c:208:17: warning: cast increases required alignment of target type [-Wcast-align]

mb_split = (memblock_t *) (((char *) mb) + BLOCK_HEAD_SIZE + size);
           ^

secmem.c: In function '_gcry_secmem_free_internal':
secmem.c:101:3: warning: cast increases required alignment of target type [-Wcast-align]

(memblock_t *) ((char *) addr - BLOCK_HEAD_SIZE)
^

secmem.c:603:8: note: in expansion of macro 'ADDR_TO_BLOCK'

mb = ADDR_TO_BLOCK (a);
     ^

In file included from secmem.c:40:0:
secmem.c:609:16: warning: cast increases required alignment of target type [-Wcast-align]

wipememory2 ((memblock_t *) ((char *) mb + BLOCK_HEAD_SIZE), (byte), size);
             ^

g10lib.h:309:54: note: in definition of macro 'wipememory2'

volatile char *_vptr=(volatile char *)(_ptr); \
                                       ^

secmem.c:611:3: note: in expansion of macro 'MB_WIPE_OUT'

MB_WIPE_OUT (0xff);
^

secmem.c:609:16: warning: cast increases required alignment of target type [-Wcast-align]

wipememory2 ((memblock_t *) ((char *) mb + BLOCK_HEAD_SIZE), (byte), size);
             ^

g10lib.h:309:54: note: in definition of macro 'wipememory2'

volatile char *_vptr=(volatile char *)(_ptr); \
                                       ^

secmem.c:612:3: note: in expansion of macro 'MB_WIPE_OUT'

MB_WIPE_OUT (0xaa);
^

secmem.c:609:16: warning: cast increases required alignment of target type [-Wcast-align]

wipememory2 ((memblock_t *) ((char *) mb + BLOCK_HEAD_SIZE), (byte), size);
             ^

g10lib.h:309:54: note: in definition of macro 'wipememory2'

volatile char *_vptr=(volatile char *)(_ptr); \
                                       ^

secmem.c:613:3: note: in expansion of macro 'MB_WIPE_OUT'

MB_WIPE_OUT (0x55);
^

secmem.c:609:16: warning: cast increases required alignment of target type [-Wcast-align]

wipememory2 ((memblock_t *) ((char *) mb + BLOCK_HEAD_SIZE), (byte), size);
             ^

g10lib.h:309:54: note: in definition of macro 'wipememory2'

volatile char *_vptr=(volatile char *)(_ptr); \
                                       ^

secmem.c:614:3: note: in expansion of macro 'MB_WIPE_OUT'

MB_WIPE_OUT (0x00);
^

secmem.c: In function '_gcry_secmem_realloc':
secmem.c:644:8: warning: cast increases required alignment of target type [-Wcast-align]

mb = (memblock_t *) ((char *) p - ((size_t) &((memblock_t *) 0)->aligned.c));
     ^
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Dec 23 2014, 12:31 PM
Parents
rC4515315f61fb: hash: fix compiler warning on ARM
Branches
Unknown
Tags
Unknown

Event Timeline

Jussi Kivilinna <jussi.kivilinna@iki.fi> committed rC99faf9cb34f8: secmem: fix compiler warnings on ARM (authored by Jussi Kivilinna <jussi.kivilinna@iki.fi>).Dec 25 2014, 10:16 AM