Hi Szymon, On Fri, Sep 21, 2012, Szymon Janc wrote: > Randomizer is optional. Handling missing randomizer in > btd_adapter_add_remote_oob_data is easy and will simplify caller code. > > --- > plugins/dbusoob.c | 7 ------- > src/adapter.c | 7 +++++++ > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c > index a66c21d..ce9e5d4 100644 > --- a/plugins/dbusoob.c > +++ b/plugins/dbusoob.c > @@ -233,13 +233,6 @@ static gboolean store_data(struct btd_adapter *adapter, struct oob_data *data) > adapter_get_address(adapter, &local); > > if (data->hash) { > - uint8_t empty_randomizer[16]; > - > - if (!data->randomizer) { > - memset(empty_randomizer, 0, sizeof(empty_randomizer)); > - data->randomizer = empty_randomizer; > - } > - > if (btd_adapter_add_remote_oob_data(adapter, &bdaddr, > data->hash, data->randomizer) < 0) > return FALSE; > diff --git a/src/adapter.c b/src/adapter.c > index d34e966..a00522a 100644 > --- a/src/adapter.c > +++ b/src/adapter.c > @@ -3574,6 +3574,13 @@ int btd_adapter_read_local_oob_data(struct btd_adapter *adapter) > int btd_adapter_add_remote_oob_data(struct btd_adapter *adapter, > bdaddr_t *bdaddr, uint8_t *hash, uint8_t *randomizer) > { > + uint8_t empty_randomizer[16]; > + > + if (!randomizer) { > + memset(empty_randomizer, 0, sizeof(empty_randomizer)); > + randomizer = empty_randomizer; > + } > + > return mgmt_add_remote_oob_data(adapter->dev_id, bdaddr, hash, > randomizer); I'd rather have mgmt_add_remote_oob_data accept a NULL pointer and have the randomizer memcpy behind a NULL test (the code is anyway already initializing the send buffer to zeros). Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html