/* If we can reuse the memfd, try that. For that it
* can't be sealed yet. */
- if (!part->sealed)
+ if (!part->sealed) {
+ assert(part->memfd_offset == 0);
+ assert(part->data == part->mmap_begin);
bus_kernel_push_memfd(m->bus, part->memfd, part->data, part->mapped, part->allocated);
- else {
+ } else {
if (part->mapped > 0)
assert_se(munmap(part->mmap_begin, part->mapped) == 0);
message_reset_parts(m);
if (m->release_kdbus) {
- struct kdbus_cmd_free cmd_free;
+ struct kdbus_cmd_free cmd_free = { };
cmd_free.flags = 0;
cmd_free.offset = (uint8_t *)m->kdbus - (uint8_t *)m->bus->kdbus_buffer;
if (m->poisoned)
return -ENOMEM;
- if (!part->data && part->memfd < 0)
+ if (!part->data && part->memfd < 0) {
part->memfd = bus_kernel_pop_memfd(m->bus, &part->data, &part->mapped, &part->allocated);
+ part->mmap_begin = part->data;
+ }
if (part->memfd >= 0) {
} else {
char *e;
- /* Maybe we can append to the signature? But only if this is the top-level container*/
+ /* Maybe we can append to the signature? But only if this is the top-level container */
if (c->enclosing != 0)
return -ENXIO;
} else {
char *e;
- /* Maybe we can append to the signature? But only if this is the top-level container*/
+ /* Maybe we can append to the signature? But only if this is the top-level container */
if (c->enclosing != 0)
return -ENXIO;
} else {
char *e;
- /* Maybe we can append to the signature? But only if this is the top-level container*/
+ /* Maybe we can append to the signature? But only if this is the top-level container */
if (c->enclosing != 0)
return -ENXIO;