* [PATCH] bluetooth:Fix variable assignment for internal function returns in the function l2cap_bredr_sig_cmd
@ 2015-12-19 4:12 Nicholas Krause
2015-12-20 7:18 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Krause @ 2015-12-19 4:12 UTC (permalink / raw)
To: marcel
Cc: gustavo, johan.hedberg, davem, linux-bluetooth, netdev, linux-kernel
This makes all internal functions that can return a error code to
properly signal this to the caller of the function l2cap_bredr_sig_cmd
by making their return value equal to the variable err before returning
to the caller of the function l2cap_bredr_sig_cmd with this value
as to allow us to correctly signal when a failure has occurred when
this particular function is called.
Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
net/bluetooth/l2cap_core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 7c65ee2..488eebe 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5319,7 +5319,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
switch (cmd->code) {
case L2CAP_COMMAND_REJ:
- l2cap_command_rej(conn, cmd, cmd_len, data);
+ err = l2cap_command_rej(conn, cmd, cmd_len, data);
break;
case L2CAP_CONN_REQ:
@@ -5328,7 +5328,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
case L2CAP_CONN_RSP:
case L2CAP_CREATE_CHAN_RSP:
- l2cap_connect_create_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_connect_create_rsp(conn, cmd, cmd_len, data);
break;
case L2CAP_CONF_REQ:
@@ -5336,7 +5336,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
break;
case L2CAP_CONF_RSP:
- l2cap_config_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_config_rsp(conn, cmd, cmd_len, data);
break;
case L2CAP_DISCONN_REQ:
@@ -5344,7 +5344,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
break;
case L2CAP_DISCONN_RSP:
- l2cap_disconnect_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_disconnect_rsp(conn, cmd, cmd_len, data);
break;
case L2CAP_ECHO_REQ:
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bluetooth:Fix variable assignment for internal function returns in the function l2cap_bredr_sig_cmd
2015-12-19 4:12 [PATCH] bluetooth:Fix variable assignment for internal function returns in the function l2cap_bredr_sig_cmd Nicholas Krause
@ 2015-12-20 7:18 ` Marcel Holtmann
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2015-12-20 7:18 UTC (permalink / raw)
To: Nicholas Krause
Cc: Gustavo F. Padovan, Johan Hedberg, David S. Miller,
linux-bluetooth, netdev, linux-kernel
Hi Nick,
> This makes all internal functions that can return a error code to
> properly signal this to the caller of the function l2cap_bredr_sig_cmd
> by making their return value equal to the variable err before returning
> to the caller of the function l2cap_bredr_sig_cmd with this value
> as to allow us to correctly signal when a failure has occurred when
> this particular function is called.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> net/bluetooth/l2cap_core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 7c65ee2..488eebe 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -5319,7 +5319,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
>
> switch (cmd->code) {
> case L2CAP_COMMAND_REJ:
> - l2cap_command_rej(conn, cmd, cmd_len, data);
> + err = l2cap_command_rej(conn, cmd, cmd_len, data);
> break;
this patch is wrong. Please try to understand on how L2CAP works and look up what the caller of l2cap_bredr_sig_cmd does with the return code. Responses can not cause another command reject.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] bluetooth:Fix variable assignment for internal function returns in the function l2cap_bredr_sig_cmd
@ 2015-08-20 22:03 Nicholas Krause
0 siblings, 0 replies; 3+ messages in thread
From: Nicholas Krause @ 2015-08-20 22:03 UTC (permalink / raw)
To: marcel
Cc: gustavo, johan.hedberg, davem, linux-bluetooth, netdev, linux-kernel
This makes all internal functions that can return a error code to
properly signal this to the caller of the function l2cap_bredr_sig_cmd
by making their return value equal to the variable err before returning
to the caller of the function l2cap_bredr_sig_cmd with this value
as to allow us to correctly signal when a failure has occurred when
calling this particular function.
Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
net/bluetooth/l2cap_core.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 45fffa4..23a885d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5319,7 +5319,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
switch (cmd->code) {
case L2CAP_COMMAND_REJ:
- l2cap_command_rej(conn, cmd, cmd_len, data);
+ err = l2cap_command_rej(conn, cmd, cmd_len, data);
break;
case L2CAP_CONN_REQ:
@@ -5328,7 +5328,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
case L2CAP_CONN_RSP:
case L2CAP_CREATE_CHAN_RSP:
- l2cap_connect_create_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_connect_create_rsp(conn, cmd, cmd_len, data);
break;
case L2CAP_CONF_REQ:
@@ -5336,7 +5336,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
break;
case L2CAP_CONF_RSP:
- l2cap_config_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_config_rsp(conn, cmd, cmd_len, data);
break;
case L2CAP_DISCONN_REQ:
@@ -5344,7 +5344,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
break;
case L2CAP_DISCONN_RSP:
- l2cap_disconnect_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_disconnect_rsp(conn, cmd, cmd_len, data);
break;
case L2CAP_ECHO_REQ:
@@ -5359,7 +5359,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
break;
case L2CAP_INFO_RSP:
- l2cap_information_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_information_rsp(conn, cmd, cmd_len, data);
break;
case L2CAP_CREATE_CHAN_REQ:
@@ -5371,7 +5371,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
break;
case L2CAP_MOVE_CHAN_RSP:
- l2cap_move_channel_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_move_channel_rsp(conn, cmd, cmd_len, data);
break;
case L2CAP_MOVE_CHAN_CFM:
@@ -5379,7 +5379,7 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
break;
case L2CAP_MOVE_CHAN_CFM_RSP:
- l2cap_move_channel_confirm_rsp(conn, cmd, cmd_len, data);
+ err = l2cap_move_channel_confirm_rsp(conn, cmd, cmd_len, data);
break;
default:
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-20 7:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-19 4:12 [PATCH] bluetooth:Fix variable assignment for internal function returns in the function l2cap_bredr_sig_cmd Nicholas Krause
2015-12-20 7:18 ` Marcel Holtmann
-- strict thread matches above, loose matches on Subject: below --
2015-08-20 22:03 Nicholas Krause
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.