* [PATCH] Bluetooth: hci_qca: Make structure qca_proto constant
@ 2019-08-15 5:51 Nishka Dasgupta
2019-08-15 6:47 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Nishka Dasgupta @ 2019-08-15 5:51 UTC (permalink / raw)
To: marcel, johan.hedberg, linux-bluetooth, linux-kernel; +Cc: Nishka Dasgupta
Static structure qca_proto, of type hci_uart_proto, is used four times:
as the last argument in function hci_uart_register_device(), and as the
only argument to functions hci_uart_register_proto() and
hci_uart_unregister_proto(). In all three of these functions, the
parameter corresponding to qca_proto is declared as constant. Therefore,
make qca_proto itself constant as well in order to protect it from
unintended modification.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/bluetooth/hci_qca.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 82a0a3691a63..80923fc9418f 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1326,7 +1326,7 @@ static int qca_setup(struct hci_uart *hu)
return ret;
}
-static struct hci_uart_proto qca_proto = {
+static const struct hci_uart_proto qca_proto = {
.id = HCI_UART_QCA,
.name = "QCA",
.manufacturer = 29,
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: Make structure qca_proto constant
2019-08-15 5:51 [PATCH] Bluetooth: hci_qca: Make structure qca_proto constant Nishka Dasgupta
@ 2019-08-15 6:47 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2019-08-15 6:47 UTC (permalink / raw)
To: Nishka Dasgupta; +Cc: Johan Hedberg, linux-bluetooth, linux-kernel
Hi Nishka,
> Static structure qca_proto, of type hci_uart_proto, is used four times:
> as the last argument in function hci_uart_register_device(), and as the
> only argument to functions hci_uart_register_proto() and
> hci_uart_unregister_proto(). In all three of these functions, the
> parameter corresponding to qca_proto is declared as constant. Therefore,
> make qca_proto itself constant as well in order to protect it from
> unintended modification.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
> drivers/bluetooth/hci_qca.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-15 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15 5:51 [PATCH] Bluetooth: hci_qca: Make structure qca_proto constant Nishka Dasgupta
2019-08-15 6:47 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).