Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp615443pxa; Thu, 27 Aug 2020 10:56:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyf8E1pnNVd74q5WbS4UiFAcZTLldCIi4g4b+Wy5dMhbRVKief6VIfozpj9nUydy0Q7bBAg X-Received: by 2002:a17:906:6895:: with SMTP id n21mr23501047ejr.155.1598550972595; Thu, 27 Aug 2020 10:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598550972; cv=none; d=google.com; s=arc-20160816; b=DL/jY56Qxkeo1SoyKmJrSCJrqmDYM0ueMH5muICXCzT+9CAPOwVkIQOcE9rG2wJmWK GkaXe0+BhrXZw6mBhUadlGRbSTe4oPVB11oWGQ7k83q8CYhAQJ1Up/ESQrLkUeohhRfE S262S3WqMJ8luvfWl1kplK3eLqQAb7Lj7fw4ttmauUqfuPjvTnUdXGjwhx5UdOpr7WgO UhmjSVywWzZtW5XwqxteMI9MXWPDpqsfzvF8XUDkN09KSxT8keQpjjMsTVg54fm0PDHB bmPAlg87bHjxICMlL6VbMGMbZTsbcbzE1lgQIsfgvGBuCvXbltN0HNkBhRmeTNpPeMZu aOGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=FxWSHY4tkPz7kEIppnRnRKwJg/ftBtShNG0VfcOcllg=; b=HATcHnGXks6RaGC5HW8Vipnf4tR5yYJCSyxdHUIxDg24dXys02kOEOiz+N6zwWWVdF eRQzSXZplNOOOxcVOWt7DW2ZNS3brpIA+/0wWjPuHvo9jf0AJyOVET2ZBzJE5ZRV0mrz CqIaoCMq7iDRVxQtb0HHfOsK8xWsoNDkVZSudb8m4S+QIitgCUZaUmEQwyH6GAr7+s+J 0gZ96PE4r454cWzPa4hV/WZtutfF4ud18/AYFmbQnlnOK3pQ5ZnWd7RaesXFEAVB2UKP vhfa8pXcJ4zM2yh/DMGq0XWu9IIs//Y4bkxT/vas94K46d1JSOxhaVK3HfnAdizYYcB/ If0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ROO70edL; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si1872607eds.68.2020.08.27.10.55.25; Thu, 27 Aug 2020 10:56:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ROO70edL; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726853AbgH0Ryx (ORCPT + 99 others); Thu, 27 Aug 2020 13:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727008AbgH0Ryv (ORCPT ); Thu, 27 Aug 2020 13:54:51 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 260BEC061264 for ; Thu, 27 Aug 2020 10:54:51 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id n23so5109768otq.11 for ; Thu, 27 Aug 2020 10:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FxWSHY4tkPz7kEIppnRnRKwJg/ftBtShNG0VfcOcllg=; b=ROO70edLc3yR8M4k/6F4f7W67wSQ493oDcm8IK5ZVfLv//zwHrYYm4oGp85zwEW2Gb eqLymJ++shHHrd3DFWCiUTSefTaDYPtZkkBVtb0p2n0gJWEZ1VyPec1qbUWF/Eh0jH1/ cLTh3wufLPAifohZABvLSwfeqneqrCY1BWdYULvE58wIbdmjCXRR3HNjEMKHLRmgAksg 4cBW+Kic/KNEA3rJG+A6LMoDbpwKaRYI5HH0KH8lLV/xNNN8VdXbcyC0znTEC4mIDnw7 Sf1WMRrgcLN/X/zleThohYArLx4AZO/rSLdLfakC4/979qZyRETjwODDqsDjKAhDCNDA sDkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FxWSHY4tkPz7kEIppnRnRKwJg/ftBtShNG0VfcOcllg=; b=DCoRDSZHlHQ+VVOWbsxBk6g1LmYPeaAOmk3ZvexG2POojCc5xkt/Oxxr3Scf1l4HzB +eFwuceMJfjT7jKZMGTlfBEYNEut8kt85VLj2K3wUwh7jaAJVRNhpw9IHh+Qz4XHbIKR ecQMxOugQ32VWcgkwRx8vxkN6onLW7g/WTQc8noyDk6gmb8lf2n5aCZQZ9m4Ow0nVPDW F+p+j62+bRcYbgHBn+jE0LyStxiMISnGyVX9HKYFgLgI0Yewo7IXZpy2hQhPzqvsSnXu otKbGKr4hf6EhGZPBTsAPQTJMuMLZH4hqNWQn1vroB7KatXbMiQL9rzPBm9xa0447lZh bPag== X-Gm-Message-State: AOAM532SoSNpHLFY+X7ClXR19Z+04WcEDjP0r4Imr9cMd6gqQhnL+pIY 5PPdiOIpdCqKBOECvlfcXkmpGhDw/YNWd9S3UEm1yuMb X-Received: by 2002:a9d:6053:: with SMTP id v19mr13543766otj.362.1598550890523; Thu, 27 Aug 2020 10:54:50 -0700 (PDT) MIME-Version: 1.0 References: <20200826063742.76007-1-sonnysasaka@chromium.org> In-Reply-To: <20200826063742.76007-1-sonnysasaka@chromium.org> From: Luiz Augusto von Dentz Date: Thu, 27 Aug 2020 10:54:39 -0700 Message-ID: Subject: Re: [PATCH BlueZ] gatt: Accept empty array in parse_includes() To: Sonny Sasaka Cc: "linux-bluetooth@vger.kernel.org" , Jie Jiang Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sonny, On Tue, Aug 25, 2020 at 11:43 PM Sonny Sasaka wrote: > > From: Jie Jiang > > Currently parse_includes() will return false if the "Includes" property > is an empty array. Empty array in the "Includes" property should be > treated as valid. > > Reviewed-by: Sonny Sasaka > > --- > src/gatt-database.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/src/gatt-database.c b/src/gatt-database.c > index 07d567078..e7e4a36a6 100644 > --- a/src/gatt-database.c > +++ b/src/gatt-database.c > @@ -2008,6 +2008,7 @@ static bool parse_includes(GDBusProxy *proxy, struct external_service *service) > DBusMessageIter iter; > DBusMessageIter array; > char *obj; > + int type; > > /* Includes property is optional */ > if (!g_dbus_proxy_get_property(proxy, "Includes", &iter)) > @@ -2018,9 +2019,9 @@ static bool parse_includes(GDBusProxy *proxy, struct external_service *service) > > dbus_message_iter_recurse(&iter, &array); > > - do { > - if (dbus_message_iter_get_arg_type(&array) != > - DBUS_TYPE_OBJECT_PATH) > + while ((type = dbus_message_iter_get_arg_type(&array)) > + != DBUS_TYPE_INVALID) { > + if (type != DBUS_TYPE_OBJECT_PATH) > return false; > > dbus_message_iter_get_basic(&array, &obj); > @@ -2028,11 +2029,12 @@ static bool parse_includes(GDBusProxy *proxy, struct external_service *service) > if (!queue_push_tail(service->includes, obj)) { > error("Failed to add Includes path in queue\n"); > return false; > - > } > > incr_attr_count(service, 1); > - } while (dbus_message_iter_next(&array)); > + > + dbus_message_iter_next(&array); > + } > > return true; > } > -- > 2.26.2 Applied, thanks. -- Luiz Augusto von Dentz