properties_changed: check for NULL iterator
v2 cover properties_changed: check for NULL iterator
v2:
----
- 7/9: don't call memcpy(x, NULL, 0) [Scan Build]
- 9/9: shorten GIT summary [GitLint]
Christian Eggers (9):
advertising: parse_secondary: fix loop condition
advertising: parse_secondary: fix mask value
advertising: parse_secondary: check for NULL iterator
advertising: parse_min_interval: reset min_interval if iter is NULL
advertising: parse_[min|max]_interval: reset value if iter is NULL
advertising: parse_tx_power: reset value if iter is NULL client/gatt: proxy_property_changed: check for NULL iterator
gatt: proxy_property_changed: check for NULL iterator
battery: provided_battery_property_changed_cb: check iterator
client/gatt.c | 17 ++++++++++------- src/advertising.c | 22 +++++++++++++++++----- src/battery.c | 10 ++++++---- src/gatt-database.c | 20 +++++++++++--------- 4 files changed, 44 insertions(+), 25 deletions(-)
Signature · 1 line
2.35.3
PATCH v2 1/9 advertising: parse_secondary: fix loop condition
"secondary" isn't an array of pointers, so the iterator can never be NULL.
--- src/advertising.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/advertising.c +1 -1
@@ -1055,7 +1055,7 @@ static bool parse_secondary(DBusMessageIter *iter,dbus_message_iter_get_basic (iter, &str); -for (sec = secondary; sec && sec->name; sec++) { +for (sec = secondary; sec->name; sec++) {if (strcmp (str, sec->name))continue ;
Signature · 1 line
2.35.3
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=679920
---Test result---
Test Summary:
CheckPatch PASS 4.24 seconds GitLint FAIL 2.93 seconds Prep - Setup ELL PASS 31.70 seconds Build - Prep PASS 0.62 seconds Build - Configure PASS 7.06 seconds Build - Make PASS 884.89 seconds Make Check PASS 11.33 seconds Make Check w/Valgrind PASS 344.83 seconds Make Distcheck PASS 211.00 seconds Build w/ext ELL - Configure PASS 7.14 seconds Build w/ext ELL - Make PASS 116.89 seconds Incremental Build w/ patches PASS 533.39 seconds Scan Build PASS 715.27 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint with rule in .gitlint
Output:
[BlueZ,v2,4/9] advertising: parse_min_interval: reset min_interval if iter is NULL
1: T1 Title exceeds max length (82>80): "[BlueZ,v2,4/9] advertising: parse_min_interval: reset min_interval if iter is NULL"
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/advertising.c:1055
error: src/advertising.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
PATCH v2 2/9 advertising: parse_secondary: fix mask value
In reply to Christian EggersIt looks like a wrong mask value is used here as only the bits mentioned in adv_secondary::flag can be set again within the loop.
Replace magic number by preprocessor macro.
--- src/advertising.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/advertising.c +1 -1
@@ -1051,7 +1051,7 @@ static bool parse_secondary(DBusMessageIter *iter,return false;/* Reset secondary channels before parsing */ - client->flags &=0xfe00 ; + client->flags &= ~MGMT_ADV_FLAG_SEC_MASK ;dbus_message_iter_get_basic (iter, &str);
Signature · 1 line
2.35.3
PATCH v2 3/9 advertising: parse_secondary: check for NULL iterator
In reply to Christian EggersThe passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
proxy->prop_func(..., ..., iter=NULL, ...)
+--src/advertising.c::properties_changed(..., ..., iter, ...);
+--parse_secondary(iter, ...);
...
---
src/advertising.c | 6 ++++++
1 file changed, 6 insertions(+)src/advertising.c +6 -0
@@ -1047,6 +1047,12 @@ static bool parse_secondary(DBusMessageIter *iter,const char *str;struct adv_secondary *sec; +if (!iter) { +/* Reset secondary channels */ + client->flags &= ~MGMT_ADV_FLAG_SEC_MASK ; +return true; + } +if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_STRING )return false;
Signature · 1 line
2.35.3
PATCH v2 4/9 advertising: parse_min_interval: reset min_interval if iter is NULL
In reply to Christian EggersSet property to its default value (as done in all other methods listed in parsers[]).
--- src/advertising.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/advertising.c +3 -1
@@ -1087,8 +1087,10 @@ static bool parse_min_interval(DBusMessageIter *iter,if (!(g_dbus_get_flags () &G_DBUS_FLAG_ENABLE_EXPERIMENTAL ))return true; -if (!iter) +if (!iter) { + client->min_interval =0 ;return false; + }if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_UINT32 )return false;
Signature · 1 line
2.35.3
PATCH v2 5/9 advertising: parse_[min|max]_interval: reset value if iter is NULL
In reply to Christian EggersSet property to its default value (as done in all other methods listed in parsers[]).
--- src/advertising.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/advertising.c +3 -1
@@ -1120,8 +1120,10 @@ static bool parse_max_interval(DBusMessageIter *iter,if (!(g_dbus_get_flags () &G_DBUS_FLAG_ENABLE_EXPERIMENTAL ))return true; -if (!iter) +if (!iter) { + client->max_interval =0 ;return false; + }if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_UINT32 )return false;
Signature · 1 line
2.35.3
PATCH v2 6/9 advertising: parse_tx_power: reset value if iter is NULL
In reply to Christian EggersSet property to its default value (as done in all other methods listed in parsers[]).
--- src/advertising.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/advertising.c +3 -1
@@ -1153,8 +1153,10 @@ static bool parse_tx_power(DBusMessageIter *iter,if (!(g_dbus_get_flags () &G_DBUS_FLAG_ENABLE_EXPERIMENTAL ))return true; -if (!iter) +if (!iter) { + client->tx_power =ADV_TX_POWER_NO_PREFERENCE ;return false; + }if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_INT16 )return false;
Signature · 1 line
2.35.3
PATCH v2 7/9 client/gatt: proxy_property_changed: check for NULL iterator
The passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
proxy->prop_func(..., ..., iter=NULL, ...)
+--client/gatt.c::proxy_property_changed(..., ..., iter, ...);
+--dbus_message_iter_get_arg_type(iter);
...
---
client/gatt.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)client/gatt.c +10 -7
@@ -3003,17 +3003,20 @@ static void proxy_property_changed(GDBusProxy *proxy, const char *name, chrc->path, bt_uuidstr_to_str(chrc->uuid), name);if (!strcmp (name,"Value" )) { -DBusMessageIter array; -uint8_t *value; -int len; +uint8_t *value ="" ;/*don't pass NULL to write_value() */ +int len =0 ; + +if (iter &&dbus_message_iter_get_arg_type (iter) == +DBUS_TYPE_ARRAY ) { +DBusMessageIter array; -if (dbus_message_iter_get_arg_type (iter) ==DBUS_TYPE_ARRAY ) {dbus_message_iter_recurse (iter, &array);dbus_message_iter_get_fixed_array (&array, &value, &len); -write_value (&chrc->value_len, &chrc->value, value, len, -0 , chrc->max_val_len); -bt_shell_hexdump (value, len); } + +write_value (&chrc->value_len, &chrc->value, value, len, +0 , chrc->max_val_len); +bt_shell_hexdump (value, len); }g_dbus_emit_property_changed (conn, chrc->path,CHRC_INTERFACE , name);
Signature · 1 line
2.35.3
PATCH v2 8/9 gatt: proxy_property_changed: check for NULL iterator
In reply to Christian EggersThe passed iterator can be NULL as in
src/gatt-database.c::properties_changed():
...
proxy->prop_func(..., ..., iter=NULL, ...)
+--client/gatt.c::property_changed_cb(..., ..., iter, ...);
+--dbus_message_iter_get_arg_type(iter);
...
---
src/gatt-database.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)src/gatt-database.c +11 -9
@@ -2867,17 +2867,19 @@ static void property_changed_cb(GDBusProxy *proxy, const char *name,if (strcmp (name,"Value" ))return ; -if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_ARRAY ) { -DBG ("Malformed \"Value\" property received" ); -return ; - } +if (iter) { +if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_ARRAY ) { +DBG ("Malformed \"Value\" property received" ); +return ; + } -dbus_message_iter_recurse (iter, &array); -dbus_message_iter_get_fixed_array (&array, &value, &len); +dbus_message_iter_recurse (iter, &array); +dbus_message_iter_get_fixed_array (&array, &value, &len); -if (len <0 ) { -DBG ("Malformed \"Value\" property received" ); -return ; +if (len <0 ) { +DBG ("Malformed \"Value\" property received" ); +return ; + } }/* Truncate the value if it's too large */
Signature · 1 line
2.35.3
PATCH v2 9/9 battery: provided_battery_property_changed_cb: check iterator
In reply to Christian EggersThe passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
proxy->prop_func(..., ..., iter=NULL, ...)
+--src/battery.c::provided_battery_property_changed_cb(, , iter, );
+--dbus_message_iter_get_arg_type(iter);
...
---
src/battery.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)src/battery.c +6 -4
@@ -252,7 +252,7 @@ static void provided_battery_property_changed_cb(GDBusProxy *proxy, DBusMessageIter *iter, void *user_data) { -uint8_t percentage; +uint8_t percentage =0 ;const char *export_path;DBusMessageIter dev_iter;
@@ -264,10 +264,12 @@ static void provided_battery_property_changed_cb(GDBusProxy *proxy,if (strcmp (name,"Percentage" ) !=0 )return ; -if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_BYTE ) -return ; +if (iter) { +if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_BYTE ) +return ; -dbus_message_iter_get_basic (iter, &percentage); +dbus_message_iter_get_basic (iter, &percentage); + }DBG ("battery percentage changed on %s, percentage = %d" ,g_dbus_proxy_get_path (proxy), percentage);
Signature · 1 line
2.35.3
Luiz Augusto von Dentz
maintainerHi Christian,
On Fri, Sep 23, 2022 at 8:02 AM Christian Eggers <[email protected]> wrote:
Perhaps you should rephrase to mention the NULL iter is actually the result of invalidate properties.
Quoted 25 lines
v2:
----
- 7/9: don't callmemcpy(x, NULL, 0)[Scan Build]
- 9/9: shorten GIT summary [GitLint]Christian Eggers (9):
advertising:parse_secondary: fix loop condition
advertising:parse_secondary: fix mask value
advertising:parse_secondary: check for NULL iterator
advertising:parse_min_interval: resetmin_intervalif iter is NULL
advertising: parse_[min|max]_interval: reset value if iter is NULL
advertising:parse_tx_power: reset value if iter is NULL client/gatt:proxy_property_changed: check for NULL iterator
gatt:proxy_property_changed: check for NULL iterator
battery:provided_battery_property_changed_cb: check iteratorclient/gatt.c | 17 ++++++++++------- src/advertising.c | 22 +++++++++++++++++----- src/battery.c | 10 ++++++---- src/gatt-database.c | 20 +++++++++++--------- 4 files changed, 44 insertions(+), 25 deletions(-)--
2.35.3
Signature · 1 line
Luiz Augusto von Dentz
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 16 lines · On Fri, 23 Sep 2022 16:55:53 +0200 you wrote:
v2:
----
- 7/9: don't callmemcpy(x, NULL, 0)[Scan Build]
- 9/9: shorten GIT summary [GitLint]Christian Eggers (9):
advertising:parse_secondary: fix loop condition
advertising:parse_secondary: fix mask value
advertising:parse_secondary: check for NULL iterator
advertising:parse_min_interval: resetmin_intervalif iter is NULL
advertising: parse_[min|max]_interval: reset value if iter is NULL
advertising:parse_tx_power: reset value if iter is NULL client/gatt:proxy_property_changed: check for NULL iterator
gatt:proxy_property_changed: check for NULL iterator
battery:provided_battery_property_changed_cb: check iterator
Quoted 1 line
[...]
Here is the summary with links:
- [BlueZ,v2,1/9] advertising: parse_secondary: fix loop condition
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=47821c473102 - [BlueZ,v2,2/9] advertising: parse_secondary: fix mask value https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=2e4327816587 - [BlueZ,v2,3/9] advertising: parse_secondary: check for NULL iterator https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=732eaa7ccf85 - [BlueZ,v2,4/9] advertising: parse_min_interval: reset min_interval if iter is NULL https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=abfb3a807c39 - [BlueZ,v2,5/9] advertising: parse_[min|max]_interval: reset value if iter is NULL https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a18d66862da1 - [BlueZ,v2,6/9] advertising: parse_tx_power: reset value if iter is NULL https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=47346e5390bb - [BlueZ,v2,7/9] client/gatt: proxy_property_changed: check for NULL iterator (no matching commit) - [BlueZ,v2,8/9] gatt: proxy_property_changed: check for NULL iterator https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f5cbe08af22e - [BlueZ,v2,9/9] battery: provided_battery_property_changed_cb: check iterator https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=15895e401e1e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html