size_t *fields_offsets,
size_t n_fields_offsets)
{
- int i;
+ size_t i;
size_t array_size = _dbus_string_get_length (str) - FIRST_GVARIANT_FIELD_OFFSET;
size_t offset_size = bus_gvariant_determine_word_size (array_size, n_fields_offsets);
int variables = 0;
dbus_bool_t prev_is_variable = FALSE;
int current_type;
- int ending_char;
-
- /* if signature is not empty, it must be after initial parenthesis */
- /* empty signature has length 1 - only nul byte */
- _dbus_assert (reader->type_pos > 0);
+ int ending_char = 0;
_dbus_type_reader_init_types_only (&r,
reader->type_str,
r.gvariant = TRUE;
r.klass = reader->klass;
- /* Check what container we're in */
- switch (_dbus_string_get_byte (r.type_str, r.type_pos-1))
+ /* In case we are in root container, we have signature without external parentheses.
+ * We go until ending nul, starting with position 0.
+ * Otherwise, we are in a container, so let's check what kind of container it is,
+ * and set proper terminating character.
+ */
+ if (r.type_pos > 0)
{
- case DBUS_STRUCT_BEGIN_CHAR:
- ending_char = DBUS_STRUCT_END_CHAR;
- break;
- case DBUS_DICT_ENTRY_BEGIN_CHAR:
- ending_char = DBUS_DICT_ENTRY_END_CHAR;
- break;
- default:
- _dbus_assert_not_reached ("function must be called inside structs or dict entries");
- break;
+ /* Check what container we're in */
+ switch (_dbus_string_get_byte (r.type_str, r.type_pos-1))
+ {
+ case DBUS_STRUCT_BEGIN_CHAR:
+ ending_char = DBUS_STRUCT_END_CHAR;
+ break;
+ case DBUS_DICT_ENTRY_BEGIN_CHAR:
+ ending_char = DBUS_DICT_ENTRY_END_CHAR;
+ break;
+ default:
+ _dbus_assert_not_reached ("function must be called inside structs or dict entries");
+ break;
+ }
}
r.finished = (_dbus_string_get_byte (r.type_str, r.type_pos) == ending_char);
#include "kdbus.h"
#include "kdbus-common.h"
#include "dbus-transport-kdbus.h"
+#include "dbus-valgrind-internal.h"
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
{
struct kdbus_cmd_free cmd;
+ /*
+ * Kdbus requires to initialize ioctl params partially. Some parts
+ * are for data passed from user to kernel, and other parts
+ * for data passed from kernel to user.
+ *
+ * Valgrind detects when uninitialized data is passed to kernel
+ * and has no way to know that it is meant to be filled by kernel.
+ * Thus, we initialize params for Valgrind to stop complaining.
+ */
+ VALGRIND_MAKE_MEM_DEFINED (&cmd, sizeof (cmd));
+
cmd.size = sizeof (cmd);
cmd.offset = offset;
cmd.flags = 0;
if (NULL == hello)
return -ENOMEM;
+ VALGRIND_MAKE_MEM_DEFINED (hello, hello_size);
+
hello->flags = flags;
hello->attach_flags_send = attach_flags_send;
hello->attach_flags_recv = attach_flags_recv;
{
struct kdbus_cmd_send cmd;
+ VALGRIND_MAKE_MEM_DEFINED (&cmd, sizeof (cmd));
+
cmd.size = sizeof (cmd);
cmd.msg_address = (__u64)msg;
cmd.flags = flags;
{
struct kdbus_cmd_recv cmd;
+ VALGRIND_MAKE_MEM_DEFINED (&cmd, sizeof (cmd));
+
cmd.size = sizeof (cmd);
cmd.flags = flags;
cmd.priority = priority;
{
struct kdbus_cmd_list cmd;
+ VALGRIND_MAKE_MEM_DEFINED (&cmd, sizeof (cmd));
+
cmd.size = sizeof (cmd);
cmd.flags = flags;
if (NULL == cmd)
return NULL;
+ VALGRIND_MAKE_MEM_DEFINED (cmd, cmd_size);
+
cmd->size = cmd_size;
cmd->flags = flags;
cmd->cookie = cookie;
{
struct kdbus_cmd_match cmd;
+ VALGRIND_MAKE_MEM_DEFINED (&cmd, sizeof (cmd));
+
cmd.cookie = cookie;
cmd.size = sizeof (struct kdbus_cmd_match);
cmd.flags = 0;