Skip to content

nimble/host: Initialize att_len in ble_att_svr_service_uuid#2221

Merged
sjanc merged 1 commit intoapache:masterfrom
sjanc:gatt_att_uninit
May 7, 2026
Merged

nimble/host: Initialize att_len in ble_att_svr_service_uuid#2221
sjanc merged 1 commit intoapache:masterfrom
sjanc:gatt_att_uninit

Conversation

@sjanc
Copy link
Copy Markdown
Contributor

@sjanc sjanc commented May 4, 2026

This is false positive as apparently some compilers doesn't handle rc and attr_len correlation correctly.

In function 'ble_att_svr_service_uuid',
inlined from 'ble_att_svr_build_read_group_type_rsp' at nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c:1956:22,
inlined from 'ble_att_svr_rx_read_group_type' at nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c:2101:10:
nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c:1833:10: warning: 'attr_len' may be used uninitialized [-Wmaybe-uninitialized]
1833 | rc = ble_uuid_init_from_buf(uuid, val, attr_len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c: In function 'ble_att_svr_rx_read_group_type':
nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c:1824:14: note: 'attr_len' was declared here
1824 | uint16_t attr_len;

@github-actions github-actions Bot added host size/XS Extra small PR labels May 4, 2026
This is false positive as apparently some compilers don't handle
rc and attr_len correlation correctly.

In function 'ble_att_svr_service_uuid',
    inlined from 'ble_att_svr_build_read_group_type_rsp' at nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c:1956:22,
    inlined from 'ble_att_svr_rx_read_group_type' at nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c:2101:10:
nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c:1833:10: warning: 'attr_len' may be used uninitialized [-Wmaybe-uninitialized]
 1833 |     rc = ble_uuid_init_from_buf(uuid, val, attr_len);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c: In function 'ble_att_svr_rx_read_group_type':
nimble/mynewt-nimble/nimble/host/src/ble_att_svr.c:1824:14: note: 'attr_len' was declared here
 1824 |     uint16_t attr_len;
@sjanc sjanc force-pushed the gatt_att_uninit branch from b76748a to d83da42 Compare May 4, 2026 13:00
@sjanc sjanc merged commit 2f990a9 into apache:master May 7, 2026
19 of 21 checks passed
@sjanc sjanc deleted the gatt_att_uninit branch May 7, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host size/XS Extra small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants