Re: [PATCH BlueZ 1/6] AVRCP: Fix initializing volume before checking PDU type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 25, 2012 at 12:02 PM, Luiz Augusto von Dentz
<luiz.dentz@xxxxxxxxx> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>
> Response may be rejected or not implemented so the operand used to
> initialize the variable may not even exist.
> ---
>  audio/avrcp.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/audio/avrcp.c b/audio/avrcp.c
> index 87a785b..2f96f27 100644
> --- a/audio/avrcp.c
> +++ b/audio/avrcp.c
> @@ -1145,12 +1145,14 @@ static gboolean avrcp_handle_volume_changed(struct avctp *session,
>  {
>        struct avrcp_player *player = user_data;
>        struct avrcp_header *pdu = (void *) operands;
> -       uint8_t abs_volume = pdu->params[1] & 0x7F;
> +       uint8_t volume;
>
>        if (code == AVC_CTYPE_REJECTED || code == AVC_CTYPE_NOT_IMPLEMENTED)
>                return FALSE;
>
> -       player->cb->set_volume(abs_volume, player->dev, player->user_data);
> +       volume = pdu->params[1] & 0x7F;
> +
> +       player->cb->set_volume(volume, player->dev, player->user_data);

Ack.

Lucas De Marchi
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux