Re: [PATCH][next] rpmsg: glink: Avoid -Wflex-array-member-not-at-end warnings

From: Gustavo A. R. Silva
Date: Wed Aug 07 2024 - 16:43:35 EST



@@ -48,7 +51,7 @@ struct glink_msg {
struct glink_defer_cmd {
struct list_head node;
- struct glink_msg msg;
+ struct glink_msg_hdr msg;
u8 data[];
};

Instead of this change (and the container_of() uses below), I think you
can just simply drop "data" here. I don't see anything using it except
the struct_size()s which can all change their "data" argument to
msg.data. e.g.:

Whaa.. I'm sorry, I totally missed this response. I think I was traveling
a lot back then.


- dcmd = kzalloc(struct_size(dcmd, data, extra), GFP_ATOMIC);
+ dcmd = kzalloc(struct_size(dcmd, msg.data, extra), GFP_ATOMIC);

With those changed, I think this patch becomes more readable.

Yes; I think I can change the code like this. :)

Thanks!
--
Gustavo