Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5234785pxv; Wed, 28 Jul 2021 06:24:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq/FCyBDZcvz0wJuMkvly3AUDblpcA951h1ZsdFv05CWQSYxLJ1CGkXF92r5fEBajZk6d1 X-Received: by 2002:a05:6602:21d6:: with SMTP id c22mr12382328ioc.69.1627478646916; Wed, 28 Jul 2021 06:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627478646; cv=none; d=google.com; s=arc-20160816; b=Mk60K6PScSfpJ4AnNFrm2oIGzmP/DriHBn9xKrusFKNnwhup30K6MvamjXTG/QmT2m Dg7Ww+FARkR2gFjeMwYIC3QkfB8y8tdjLv37Au1TgRySm01/3iDZXtScI/XCwpgjlTLn ZgMSFJX0mTcAXi8Aqi8tgvOePX6EV5JM+TI7AiD/e8EW5YSivdXJLqMbJzPA5W38v86w q6xRcdvYPoBU5buJyiAiq93XaAAm6oyQC5FPIz9+2dEsWq9SfyUddXOV0bbW8mlpWa0B CN51JMn+hLMQ4L1AkdfkeduZblx4X44teFCikLNFZ2CT1/4os6fC+uZHT0c1d4eMgBxl rdAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=qOenT5vGuREZjOeQZhrIQYj+foyedhyCo05+xZGFt9s=; b=UjMaXPOdb7wHuS7qPuyrPIj19ifWUa2R63daB0FX5ni+vsIb51aXmx7erJQgHe+Bxs qTeixb4xRxMuyWMIJR+BjS+7tpdQ/K97hU9Ro/vlJ7WkrAqMgt5lHwKhQMKSz8hb7NXr nwkJPotAZQ4XR0PSZxjm36R+gjWkcuaBX3mxzi6TXs9GdQWZ5aUmu+9Gy0PdAxLlreok JdL7ILqZUxNRXx4GCTa7TRyTiEUall72oqYIMte7xFkbWc/vgGwrWYb2VIyAODc0nc9s HLN3Jy2Vwg/UYSfpmkt/6pLoulMArsgj+WX+D0y+igyM9iR6C/jg00Xl2WSelxiMP5IH HWtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Uijolomk; 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 g15si7448882ilc.45.2021.07.28.06.23.53; Wed, 28 Jul 2021 06:24:06 -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=Uijolomk; 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 S235260AbhG1NXN (ORCPT + 99 others); Wed, 28 Jul 2021 09:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235227AbhG1NXN (ORCPT ); Wed, 28 Jul 2021 09:23:13 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3CD2C061764 for ; Wed, 28 Jul 2021 06:23:11 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id y3-20020ae9f4030000b02903b916ae903fso492553qkl.6 for ; Wed, 28 Jul 2021 06:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=qOenT5vGuREZjOeQZhrIQYj+foyedhyCo05+xZGFt9s=; b=UijolomkkedgNmlaU6ROawvJg+WEhF5ulxYY0FNlATcoJxhMn+z2e1hqM/8/iIEbsW ZHGs/gsr87saOhSj2bbdYHtCkNr85gwJYt2VyX17WxyPJuT2LZBlZlTeAn4y163tPDHS 6qGWKpqpbo3Fm+fsxHLwOXFOVj5IhLh+xc1MIRXi7jlybtNuvbGsZqkRglzDfUxZuHFQ G7Fea9XwxABScrEI3NZbAgFVH6nGP1mTG4RVGrHH06hrvCvIrXxZ6qFDmJjmjjgAYulT ASVFM6NCb6oNEiOCtSl+Li5A03ZqlyRP+BfFC7R/ujaAs3GB75gwcGeclt9gqBruRDD1 k7Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=qOenT5vGuREZjOeQZhrIQYj+foyedhyCo05+xZGFt9s=; b=I2Zlu7NvdvCnCYUCSvEuNvYQxqrxU7Kxw1mzGQCf4QCdSl1hO+xH36m9vDI21w/kKA aFcWVkBKAIbogNtvDta7f+tjcuD8KNtsE0/WL1ccnQ359E5jQxP8cEZKAh0nPsws3U9n jBFZveOlLcndAWLqZASc0soYU0YZV0yliNU85vqySrERuF4DJlEGJdfHlsCmo+L95frU ebVQmSDa73GKXSCDyRoL5Tvt1BcbYHNrelfFfg6cMCBuopnae9wK1/Pm3+EZAYaLp4T9 Sdm8sCKy9AnSr337vrr/Sj3Nii/9gT9tLXIeaILr9ktJcpKPNNyQ2xAzLcjqyHSXHw6/ 2A+w== X-Gm-Message-State: AOAM530zKeoxRhgifCQeB614zsIFEXpUhCqlLz8cNIA15NMPaTL9Uhhg kuUGu159rXu/dJVk0Qr5rGSofPWuMCHtOOPa1VDZ14guR/9U+VarI3dndjIUdba03xity2SoJis g/VVstAs0cE3ZwBrXHFzbM4yF3kjXc7xMgWwhq4j8/50IYvbcFYEIgcbAso8H9PcZABXNUbtevT jLUUhDD4ExM/o= X-Received: from howardchung-p920.tpe.corp.google.com ([2401:fa00:1:10:9b6a:9d1f:2f3e:45de]) (user=howardchung job=sendgmr) by 2002:a05:6214:e4c:: with SMTP id o12mr28154271qvc.18.1627478590670; Wed, 28 Jul 2021 06:23:10 -0700 (PDT) Date: Wed, 28 Jul 2021 21:23:04 +0800 Message-Id: <20210728212259.Bluez.v2.1.I20397b8350f98567b8d52b895442c768250a6ab3@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.32.0.432.gabb21c7263-goog Subject: [Bluez PATCH v2] gatt-db: fix service in range check From: Howard Chung To: linux-bluetooth@vger.kernel.org Cc: Yun-Hao Chung , Archie Pusaka Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Yun-Hao Chung The previous check already makes sure the service range overlaps with the search range. There is no need to add another check. Reviewed-by: Archie Pusaka --- Changes in v2: - remove the entire check src/shared/gatt-db.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c index 8bff4d37aaa2..658f82812cf6 100644 --- a/src/shared/gatt-db.c +++ b/src/shared/gatt-db.c @@ -1347,12 +1347,8 @@ static void foreach_in_range(void *data, void *user_data) if (svc_start > foreach_data->end || svc_end < foreach_data->start) return; - if (!foreach_data->attr) { - if (svc_start < foreach_data->start || - svc_start > foreach_data->end) - return; + if (!foreach_data->attr) return foreach_service_in_range(data, user_data); - } for (i = 0; i < service->num_handles; i++) { struct gatt_db_attribute *attribute = service->attributes[i]; -- 2.32.0.432.gabb21c7263-goog