* [PATCH BlueZ] shared/att: Fix responding to unknown command opcode
@ 2017-04-26 14:19 Luiz Augusto von Dentz
2017-04-26 14:49 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2017-04-26 14:19 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In case of receiving an unknown command no response shall be generated.
---
src/shared/att.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/att.c b/src/shared/att.c
index 3071b51..10e182f 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -148,7 +148,7 @@ static enum att_op_type get_op_type(uint8_t opcode)
return att_opcode_type_table[i].type;
}
- return ATT_OP_TYPE_UNKNOWN;
+ return opcode & ATT_OP_CMD_MASK ? ATT_OP_TYPE_CMD : ATT_OP_TYPE_UNKNOWN;
}
static const struct {
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH BlueZ] shared/att: Fix responding to unknown command opcode
2017-04-26 14:19 [PATCH BlueZ] shared/att: Fix responding to unknown command opcode Luiz Augusto von Dentz
@ 2017-04-26 14:49 ` Marcel Holtmann
2017-04-27 13:02 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2017-04-26 14:49 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
> In case of receiving an unknown command no response shall be generated.
> ---
> src/shared/att.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/shared/att.c b/src/shared/att.c
> index 3071b51..10e182f 100644
> --- a/src/shared/att.c
> +++ b/src/shared/att.c
> @@ -148,7 +148,7 @@ static enum att_op_type get_op_type(uint8_t opcode)
> return att_opcode_type_table[i].type;
> }
>
> - return ATT_OP_TYPE_UNKNOWN;
> + return opcode & ATT_OP_CMD_MASK ? ATT_OP_TYPE_CMD : ATT_OP_TYPE_UNKNOWN;
> }
for readability I would use this:
return (opcode & ATT_OP_CMD_MASK) ? ATT_OP_TYPE_CMD : ATT_OP_TYPE_UNKNOWN;
Or just do this:
if (opcode & ATT_OP_CMD_MASK)
return ATT_OP_TYPE_CMD;
return ATT_OP_TYPE_UNKNOWN;
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ] shared/att: Fix responding to unknown command opcode
2017-04-26 14:49 ` Marcel Holtmann
@ 2017-04-27 13:02 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2017-04-27 13:02 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
Hi Marcel,
On Wed, Apr 26, 2017 at 5:49 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Luiz,
>
>> In case of receiving an unknown command no response shall be generated.
>> ---
>> src/shared/att.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/shared/att.c b/src/shared/att.c
>> index 3071b51..10e182f 100644
>> --- a/src/shared/att.c
>> +++ b/src/shared/att.c
>> @@ -148,7 +148,7 @@ static enum att_op_type get_op_type(uint8_t opcode)
>> return att_opcode_type_table[i].type;
>> }
>>
>> - return ATT_OP_TYPE_UNKNOWN;
>> + return opcode & ATT_OP_CMD_MASK ? ATT_OP_TYPE_CMD : ATT_OP_TYPE_UNKNOWN;
>> }
>
> for readability I would use this:
>
> return (opcode & ATT_OP_CMD_MASK) ? ATT_OP_TYPE_CMD : ATT_OP_TYPE_UNKNOWN;
>
> Or just do this:
>
> if (opcode & ATT_OP_CMD_MASK)
> return ATT_OP_TYPE_CMD;
>
> return ATT_OP_TYPE_UNKNOWN;
Ive made these modifications above and applied the patch.
> Regards
>
> Marcel
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-27 13:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-26 14:19 [PATCH BlueZ] shared/att: Fix responding to unknown command opcode Luiz Augusto von Dentz
2017-04-26 14:49 ` Marcel Holtmann
2017-04-27 13:02 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox