1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00

bus-message: avoid -Wnull-pointer-arithmetic warning on new clang

We just need some pointer, so use alignment directly converted
to the right type.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-01-18 16:23:09 +11:00
parent 1aaadf859b
commit 0241c1c0ee

View File

@ -1320,7 +1320,9 @@ static void *message_extend_body(
m->n_body_parts <= 0 || m->n_body_parts <= 0 ||
m->body_end->sealed || m->body_end->sealed ||
(padding != ALIGN_TO(m->body_end->size, align) - m->body_end->size) || (padding != ALIGN_TO(m->body_end->size, align) - m->body_end->size) ||
(force_inline && m->body_end->size > MEMFD_MIN_SIZE); /* if this must be an inlined extension, let's create a new part if the previous part is large enough to be inlined */ (force_inline && m->body_end->size > MEMFD_MIN_SIZE);
/* If this must be an inlined extension, let's create a new part if
* the previous part is large enough to be inlined. */
if (add_new_part) { if (add_new_part) {
if (padding > 0) { if (padding > 0) {
@ -1367,7 +1369,7 @@ static void *message_extend_body(
} }
} else } else
/* Return something that is not NULL and is aligned */ /* Return something that is not NULL and is aligned */
p = (uint8_t *) NULL + align; p = (uint8_t*) align;
m->body_size = end_body; m->body_size = end_body;
message_extend_containers(m, added); message_extend_containers(m, added);
@ -4778,7 +4780,7 @@ _public_ int sd_bus_message_read_array(
if (sz == 0) if (sz == 0)
/* Zero length array, let's return some aligned /* Zero length array, let's return some aligned
* pointer that is not NULL */ * pointer that is not NULL */
p = (uint8_t*) NULL + align; p = (uint8_t*) align;
else { else {
r = message_peek_body(m, &m->rindex, align, sz, &p); r = message_peek_body(m, &m->rindex, align, sz, &p);
if (r < 0) if (r < 0)