wifi: ath11k: Fix qmi_msg_handler data structure initialization
PATCH 1/1 wifi: ath11k: Fix qmi_msg_handler data structure initialization
qmi_msg_handler is required to be null terminated by QMI module. There might be a case where a handler for a msg id is not present in the handlers array which can lead to infinite loop while searching the handler and therefore out of bound access in qmi_invoke_handler(). Hence update the initialization in qmi_msg_handler data structure.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/qmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath11k/qmi.c +1 -0
@@ -3090,6 +3090,7 @@ static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { sizeof(struct qmi_wlfw_fw_init_done_ind_msg_v01), .fn = ath11k_qmi_msg_fw_init_done_cb, }, + {/* end of list */ } }; static int ath11k_qmi_ops_new_server(struct qmi_handle *qmi_hdl,
base-commit: 087c436cbc8b1bf3d3bc7ea94d6757d74ea2f470
Signature · 7 lines
2.38.0 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
drivers/net/wireless/ath/ath11k/qmi.c static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { · line 3094
Quoted 3 lines · Rahul Bhattacharjee
},drivers/net/wireless/ath/ath11k/qmi.c +1
-0+ {/* end of list */ } };
Do you want to add a comma after that last list element?
Actually, I normally see the last list element simply being
Review
Quoted 1 line
(quoted diff) +1
-0+ {},
... with no comment necessary.
Quoted 7 lines · Joseph S. Barrera III
drivers/net/wireless/ath/ath11k/qmi.c static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { · line 3094
Quoted 3 lines · Rahul Bhattacharjee
},drivers/net/wireless/ath/ath11k/qmi.c +1
-0+ {/* end of list */ } };Do you want to add a comma after that last list element?
I can add that in the pending branch.
Quoted 6 lines
Actually, I normally see the last list element simply being
Review
Quoted 1 line
(quoted diff) +1
-0+ {},... with no comment necessary.
I would prefer to have a comment to make it more visible that an empty element is needed at the end, but I would add that outside of braces?
/* end of list */
{},
Thoughts? I can change this in the pending branch.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 14 lines · Kalle Valo
Quoted 6 lines · Joseph S. Barrera III
drivers/net/wireless/ath/ath11k/qmi.c static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { · line 3094
Quoted 3 lines · Rahul Bhattacharjee
},drivers/net/wireless/ath/ath11k/qmi.c +1
-0+ {/* end of list */ } };Do you want to add a comma after that last list element?
I can add that in the pending branch.
Quoted 4 lines
Actually, I normally see the last list element simply being
Review
Quoted 1 line
(quoted diff) +1
-0+ {},... with no comment necessary.
Quoted 7 lines
I would prefer to have a comment to make it more visible that an empty element is needed at the end, but I would add that outside of braces?
/* end of list */
{},Thoughts? I can change this in the pending branch.
LGTM!
Signature · 3 lines
ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 4 lines · Kalle Valo
Quoted 1 line · Joseph S. Barrera III
Do you want to add a comma after that last list element?
I can add that in the pending branch.
I think that would be good.
Quoted 5 lines
I would prefer to have a comment to make it more visible that an empty element is needed at the end, but I would add that outside of braces?
/* end of list */
{},
Ending a list with {}, is such a common idiom that adding a comment
is kind of just noise. And if you look at other such instances of
ending with an empty element, you'll find no comment, just the {},.
When making changes I prefer to stick to the existing coding style
as much as possible, so in this case I would definitely omit the comment. But if you do feel like you need to add a comment, I would keep it on the same line as the empty element, probably like
{}, // end of list
Signature · 3 lines
ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 10 lines · Rahul Bhattacharjee
qmi_msg_handleris required to be null terminated by QMI module. There might be a case where a handler for a msg id is not present in the handlers array which can lead to infinite loop while searching the handler and therefore out of bound access inqmi_invoke_handler(). Hence update the initialization inqmi_msg_handlerdata structure.Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
Signed-off-by Rahul Bhattacharjee <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
ed3725e15a15 wifi: ath11k: Fix qmi_msg_handler data structure initialization
Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k