Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4862068pxv; Tue, 27 Jul 2021 19:22:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxMMNip3uE+Kz8wFsCPtWRchorkf7JHvQ+Vn5Og2Wb+uqqAG69z5EBIcPHNcmK2xA5ZGGQ X-Received: by 2002:a17:907:961b:: with SMTP id gb27mr24998380ejc.340.1627438943071; Tue, 27 Jul 2021 19:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627438943; cv=none; d=google.com; s=arc-20160816; b=njTtRlXrcj2DWEUOjCDjhXMoDJdi0T1QGqcKksub0RXvmMoTUsNc/cPWsduR/PWNXq PZzqPaAd2rAoDXMAulrR6HAZdYYMM4tZyA0XVdrzuVzwgUvleU8Vs2pG7Qy6vImqdWOX twraXb9QkBgS7Ha2tXjZFxNAiY+O1WJS+XGnUAEzIhdkZTjyKh8Bq8Em8mSzlMW10tXg DuMqNS6zszEKEXucPAu91pDHtYdKPpfjNF8vrfVo4KMpsJCPVzrPZaEZf2zcQ4antKq3 9eH60wURRM13AANpKsZyu2CtNolRFH+oHvccyLHtxpYB0D5G/gzOxyf/eeCVKwuN7iiB JeQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=igsOLvBESUcRgxaqZtcUjwOr4/I59ieON4y08DvjreI=; b=qRUmM43XjOB8aHXnsQ8ZMNolyT/B6PQ2bfImmijuWVLe7uFDTZOKkXdSs9GqolEjGz 6r8oGUCXr31Q9szvnIyg5HLmPAthVUjel0aoAYtMnB9VxhqDbdFu4CCTeII2lt26JG+F 0dpOdTtfYkKBzQ+8cxxbH8Axdw8sl5kCpDfAhR7r6DkegB2KRXKGNs2LOPSkEw/X+LuK rtGlDOiiMYjjJatwdloXVkIIq3s+swrXS4di0IcVd6VPBetXIaeFKLJVtnDXKWOJI5a4 opQKcl0y6ZOB9UcVOlsbNgN7inFsfVxqLhKSYv+RUNhuRVrZpmD6HL5FQtqw57kas2QD oGMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DwRCfimO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si5701804edb.418.2021.07.27.19.21.58; Tue, 27 Jul 2021 19:22:23 -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=@google.com header.s=20161025 header.b=DwRCfimO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233436AbhG1CUK (ORCPT + 99 others); Tue, 27 Jul 2021 22:20:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233223AbhG1CUJ (ORCPT ); Tue, 27 Jul 2021 22:20:09 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D81F0C061757 for ; Tue, 27 Jul 2021 19:20:06 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id o5so2047035ejy.2 for ; Tue, 27 Jul 2021 19:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=igsOLvBESUcRgxaqZtcUjwOr4/I59ieON4y08DvjreI=; b=DwRCfimOpsPUaHoq4L35vCRCPOMsFMd9qDBTGxCPvWRf+NMx4Drcsz9B89nVT+OsbJ tJbCFUIdeikeA0HqCeZNlM3Bf6IAahAJKhXMWu3IbSCQw2UI+lOvqSXRq2clqiLixeCY b4CNIo6KJ5PNohLzAmYLBkp6+XJgvcujT0jvLbNhY6VwnYbR6poZPD0w9Xe2RAnBdDDx lnSg9biP6y0rXmYUcMzPhSnHhnMh0hA7Hm73y11ohRG2red++d5Q9OxkgGoh08Jn4Yny 0pfZtrfFL60ldxhSZ7mcjGFrjq87PsaQpbBV806tgY6sqx8jJxc1UPE50yz/76UgwzhD rkFQ== 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=igsOLvBESUcRgxaqZtcUjwOr4/I59ieON4y08DvjreI=; b=IdL1Z11+KmHvueLp8pJuLW4PS6eggdS+4bjLzDtq5JiOUzoCcC8Wc9TK+FhQeEhuAq 75zYakZBphUiuO4rG6gyCfwC0r51wtUq2WeFheR0u/DPOF0Er7uYVN5Z5fh9xy2kPx+3 e7NwOSeeur+qt0V9RVjhgXuWyK7J2BQ02YEHBI3LsQjR0wjmUOWNRTRozulV4vahUqHR 8dN5ptHBKb5mlg/6VVqof+47nebcvRG4L981yGqa5Qqj7l1/qjFtk9RtdCS6PZg9C9fD DS7AeavGeM96R/gYzIGkLq/HQTOg4o3IPB2eMmXIHxO8kP08G3q0++j5IDIxSFApiKsQ KXcw== X-Gm-Message-State: AOAM531Vx2+Ohckx1882BptfDwc3Mmduq7GXOqG6M2CivsO0jb0Kfg+K yCU04pRYyHW6vr4owMG4dQfbhg6Wxg5/ekOEcL9fyA== X-Received: by 2002:a17:906:8a98:: with SMTP id mu24mr13299394ejc.404.1627438805196; Tue, 27 Jul 2021 19:20:05 -0700 (PDT) MIME-Version: 1.0 References: <20210727195057.Bluez.v1.1.I20397b8350f98567b8d52b895442c768250a6ab3@changeid> In-Reply-To: From: Yun-hao Chung Date: Wed, 28 Jul 2021 10:19:54 +0800 Message-ID: Subject: Re: [Bluez PATCH v1] gatt-db: fix service in range check To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" , Yun-Hao Chung , Archie Pusaka Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org I see. To be honest, I didn't encounter any issues with this function. I was trying to solve another problem and found this might be a typo. Thanks for the explanation. On Wed, Jul 28, 2021 at 6:18 AM Luiz Augusto von Dentz wrote: > > Hi Howard, > > On Tue, Jul 27, 2021 at 4:53 AM Howard Chung wrote: > > > > From: Yun-Hao Chung > > > > If foreach_data->start < svc_start < foreach_data->end < svc_end, > > foreach_in_range runs foreach_service_in_range to this service. > > > > This patch fix the above bug. > > > > Reviewed-by: Archie Pusaka > > --- > > > > src/shared/gatt-db.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c > > index 8bff4d37aaa2..38d93f273a9e 100644 > > --- a/src/shared/gatt-db.c > > +++ b/src/shared/gatt-db.c > > @@ -1349,7 +1349,7 @@ static void foreach_in_range(void *data, void *user_data) > > > > if (!foreach_data->attr) { > > if (svc_start < foreach_data->start || > > - svc_start > foreach_data->end) > > + svc_end > foreach_data->end) > > return; > > Actually if I recall this check is correct, we want to iterate to > every service within the range of start to end, if the range is lets > say 1-9 and the service is 1-14 is still within the range since it > matches the range of 1-9, or perhaps you want to explain why that > would be a problem since that is not explained in the patch > description, if we do switch to strict matching it is probably worth > documenting that we would only match if the entire range of services > is within the range, anyway I would still keep svc_start > > foreach_data->end since that would stop iterating early instead of > continuing to all the list. > > > return foreach_service_in_range(data, user_data); > > } > > -- > > 2.32.0.432.gabb21c7263-goog > > > > > -- > Luiz Augusto von Dentz