Skip to content

[PW_SID:1078355] [RESEND,next] Bluetooth: hci.h: Avoid a couple -Wflex-array-member-not-at-end warnings - #3461

Closed
BluezTestBot wants to merge 2 commits into
workflowfrom
1078355
Closed

BluezTestBot wants to merge 2 commits into
workflowfrom
1078355

Conversation

@BluezTestBot

Copy link
Copy Markdown
Owner

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

struct hci_std_codecs and struct hci_std_codecs_v2 are flexible
structures, this is structures that contain a flexible-array member
(__u8 codec[]; and struct hci_std_codec_v2 codec[];, correspondingly.)

Since struct hci_rp_read_local_supported_codecs and struct
hci_rp_read_local_supported_codecs_v2 are defined by hardware, we
create the new struct hci_std_codecs_hdr and struct hci_std_codecs_v2_hdr
types, and use them to replace the object types causing trouble in
struct hci_rp_read_local_supported_codecs and struct
hci_rp_read_local_supported_codecs_v2, namely struct hci_std_codecs
std_codecs; and struct hci_std_codecs_v2_hdr std_codecs;.

Also, once -fms-extensions is enabled, we can use transparent struct
members in both struct hci_std_codecs and struct hci_std_codecs_v2_hdr.

Notice that the newly created types does not contain the flex-array
member codec, which is the object causing the -Wfamnae warnings.

After these changes, the size of struct hci_rp_read_local_supported_codecs
and struct hci_rp_read_local_supported_codecs_v2, along with their
member's offsets remain the same, hence the memory layouts don't
change:

Before changes:
struct hci_rp_read_local_supported_codecs {
__u8 status; /* 0 1 /
struct hci_std_codecs std_codecs; /
1 1 /
struct hci_vnd_codecs vnd_codecs; /
2 1 */

    /* size: 3, cachelines: 1, members: 3 */
    /* last cacheline: 3 bytes */

} attribute((packed));

struct hci_rp_read_local_supported_codecs_v2 {
__u8 status; /* 0 1 /
struct hci_std_codecs_v2 std_codecs; /
1 1 /
struct hci_vnd_codecs_v2 vendor_codecs; /
2 1 */

    /* size: 3, cachelines: 1, members: 3 */
    /* last cacheline: 3 bytes */

} attribute((packed));

After changes:
struct hci_rp_read_local_supported_codecs {
__u8 status; /* 0 1 /
struct hci_std_codecs_hdr std_codecs; /
1 1 /
struct hci_vnd_codecs vnd_codecs; /
2 1 */

/* size: 3, cachelines: 1, members: 3 */
/* last cacheline: 3 bytes */

} attribute((packed));

struct hci_rp_read_local_supported_codecs_v2 {
__u8 status; /* 0 1 /
struct hci_std_codecs_v2_hdr std_codecs; /
1 1 /
struct hci_vnd_codecs_v2 vendor_codecs; /
2 1 */

/* size: 3, cachelines: 1, members: 3 */
/* last cacheline: 3 bytes */

} attribute((packed));

With these changes fix the following warnings:

include/net/bluetooth/hci.h:1490:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
include/net/bluetooth/hci.h:1525:34: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva gustavoars@kernel.org

include/net/bluetooth/hci.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

tedd-an and others added 2 commits April 7, 2026 20:07
This patch adds workflow files for ci:

[sync.yml]
 - The workflow file for scheduled work
 - Sync the repo with upstream repo and rebase the workflow branch
 - Review the patches in the patchwork and creates the PR if needed

[ci.yml]
 - The workflow file for CI tasks
 - Run CI tests when PR is created

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

struct hci_std_codecs and struct hci_std_codecs_v2 are flexible
structures, this is structures that contain a flexible-array member
(__u8 codec[]; and struct hci_std_codec_v2 codec[];, correspondingly.)

Since struct hci_rp_read_local_supported_codecs and struct
hci_rp_read_local_supported_codecs_v2 are defined by hardware, we
create the new struct hci_std_codecs_hdr and struct hci_std_codecs_v2_hdr
types, and use them to replace the object types causing trouble in
struct hci_rp_read_local_supported_codecs and struct
hci_rp_read_local_supported_codecs_v2, namely struct hci_std_codecs
std_codecs; and struct hci_std_codecs_v2_hdr std_codecs;.

Also, once -fms-extensions is enabled, we can use transparent struct
members in both struct hci_std_codecs and struct hci_std_codecs_v2_hdr.

Notice that the newly created types does not contain the flex-array
member `codec`, which is the object causing the -Wfamnae warnings.

After these changes, the size of struct hci_rp_read_local_supported_codecs
and struct hci_rp_read_local_supported_codecs_v2, along with their
member's offsets remain the same, hence the memory layouts don't
change:

Before changes:
struct hci_rp_read_local_supported_codecs {
        __u8                       status;               /*     0     1 */
        struct hci_std_codecs      std_codecs;           /*     1     1 */
        struct hci_vnd_codecs      vnd_codecs;           /*     2     1 */

        /* size: 3, cachelines: 1, members: 3 */
        /* last cacheline: 3 bytes */
} __attribute__((__packed__));

struct hci_rp_read_local_supported_codecs_v2 {
        __u8                       status;               /*     0     1 */
        struct hci_std_codecs_v2   std_codecs;           /*     1     1 */
        struct hci_vnd_codecs_v2   vendor_codecs;        /*     2     1 */

        /* size: 3, cachelines: 1, members: 3 */
        /* last cacheline: 3 bytes */
} __attribute__((__packed__));

After changes:
struct hci_rp_read_local_supported_codecs {
	__u8                       status;               /*     0     1 */
	struct hci_std_codecs_hdr  std_codecs;           /*     1     1 */
	struct hci_vnd_codecs      vnd_codecs;           /*     2     1 */

	/* size: 3, cachelines: 1, members: 3 */
	/* last cacheline: 3 bytes */
} __attribute__((__packed__));

struct hci_rp_read_local_supported_codecs_v2 {
	__u8                       status;               /*     0     1 */
	struct hci_std_codecs_v2_hdr std_codecs;         /*     1     1 */
	struct hci_vnd_codecs_v2   vendor_codecs;        /*     2     1 */

	/* size: 3, cachelines: 1, members: 3 */
	/* last cacheline: 3 bytes */
} __attribute__((__packed__));

With these changes fix the following warnings:

include/net/bluetooth/hci.h:1490:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
include/net/bluetooth/hci.h:1525:34: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

CheckPatch
Desc: Run checkpatch.pl script
Duration: 0.45 seconds
Result: PENDING

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

GitLint
Desc: Run gitlint
Duration: 0.30 seconds
Result: PENDING

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

SubjectPrefix
Desc: Check subject contains "Bluetooth" prefix
Duration: 0.10 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

BuildKernel
Desc: Build Kernel for Bluetooth
Duration: 26.23 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

CheckAllWarning
Desc: Run linux kernel with all warning enabled
Duration: 28.84 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

CheckSparse
Desc: Run sparse tool with linux kernel
Duration: 27.69 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

BuildKernel32
Desc: Build 32bit Kernel for Bluetooth
Duration: 25.71 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunnerSetup
Desc: Setup kernel and bluez for test-runner
Duration: 576.20 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_l2cap-tester
Desc: Run l2cap-tester with test-runner
Duration: 28.40 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_iso-tester
Desc: Run iso-tester with test-runner
Duration: 40.63 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_bnep-tester
Desc: Run bnep-tester with test-runner
Duration: 6.48 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_mgmt-tester
Desc: Run mgmt-tester with test-runner
Duration: 115.67 seconds
Result: FAIL
Output:

Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
Read Exp Feature - Success                           Failed       0.112 seconds

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_rfcomm-tester
Desc: Run rfcomm-tester with test-runner
Duration: 9.52 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_sco-tester
Desc: Run sco-tester with test-runner
Duration: 14.64 seconds
Result: FAIL
Output:

WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_ioctl-tester
Desc: Run ioctl-tester with test-runner
Duration: 10.58 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_mesh-tester
Desc: Run mesh-tester with test-runner
Duration: 12.52 seconds
Result: FAIL
Output:

Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 1                               Timed out    2.660 seconds
Mesh - Send cancel - 2                               Timed out    1.995 seconds

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_smp-tester
Desc: Run smp-tester with test-runner
Duration: 8.64 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

TestRunner_userchan-tester
Desc: Run userchan-tester with test-runner
Duration: 6.82 seconds
Result: PASS

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

IncrementalBuild
Desc: Incremental build with the patches in the series
Duration: 0.50 seconds
Result: PENDING

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants