2015-09-22 18:56:52

by Szymon Janc

[permalink] [raw]
Subject: [PATCH] audio/avrcp: Remove not needed null check in

Browsing handlers are always getting valid pdu pointer so there is no
need to double check that. Also pdu pointer is already dereferenced
before calling handler.
---
profiles/audio/avrcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 53170ec..24deac5 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1946,7 +1946,7 @@ static void avrcp_handle_get_folder_items(struct avrcp *session,
uint8_t scope;
uint8_t status = AVRCP_STATUS_SUCCESS;

- if (!pdu || ntohs(pdu->param_len) < 10) {
+ if (ntohs(pdu->param_len) < 10) {
status = AVRCP_STATUS_INVALID_PARAM;
goto failed;
}
--
2.5.0



2015-09-23 07:56:17

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH] audio/avrcp: Remove not needed null check in

Hi Szymon,

On Tue, Sep 22, 2015 at 9:56 PM, Szymon Janc <[email protected]> wrote:
> Browsing handlers are always getting valid pdu pointer so there is no
> need to double check that. Also pdu pointer is already dereferenced
> before calling handler.
> ---
> profiles/audio/avrcp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
> index 53170ec..24deac5 100644
> --- a/profiles/audio/avrcp.c
> +++ b/profiles/audio/avrcp.c
> @@ -1946,7 +1946,7 @@ static void avrcp_handle_get_folder_items(struct avrcp *session,
> uint8_t scope;
> uint8_t status = AVRCP_STATUS_SUCCESS;
>
> - if (!pdu || ntohs(pdu->param_len) < 10) {
> + if (ntohs(pdu->param_len) < 10) {
> status = AVRCP_STATUS_INVALID_PARAM;
> goto failed;
> }
> --
> 2.5.0

Applied, thanks.


--
Luiz Augusto von Dentz