Re: [PATCH BlueZ] mesh: Fix proxy PDU SAR msg length

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

 



Hi Robert,

On Fri, Mar 16, 2018 at 10:14 AM, Robert Lubaś <robert.lubas@xxxxxxxxxxx> wrote:
> In read_pipe function there was a mishandled case when the msg has
> more than one segment. As a result e.g. after provisioning the
> capabilities discovery was incorrect parsed.
>
> ---
>  mesh/gatt.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/mesh/gatt.c b/mesh/gatt.c
> index 9116a9de1..8fecac10b 100644
> --- a/mesh/gatt.c
> +++ b/mesh/gatt.c
> @@ -383,7 +383,7 @@ static bool pipe_read(struct io *io, bool prov,
> void *user_data)
>         uint8_t buf[512];
>         uint8_t *res;
>         int fd = io_get_fd(io);
> -       ssize_t len;
> +       ssize_t len, len_sar;
>
>         if (io != notify_io)
>                 return true;
> @@ -393,14 +393,13 @@ static bool pipe_read(struct io *io, bool prov,
> void *user_data)
>                         break;
>
>                 res = buf;
> -               mesh_gatt_sar(&res, len);
> -
> -               if (prov)
> -                       prov_data_ready(node, res, len);
> -               else
> -                       net_data_ready(res, len);
> +               if (len_sar = mesh_gatt_sar(&res, len)) {

Leave the assignment outside of if statement like:

len_sar =...
if (len_sar)...

> +                       if (prov)
> +                               prov_data_ready(node, res, len_sar);
> +                       else
> +                               net_data_ready(res, len_sar);
> +               }
>         }
> -
>         return true;
>  }

Other than that it looks fine.

-- 
Luiz Augusto von Dentz
--
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