Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1114314pxx; Fri, 30 Oct 2020 02:21:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYPCy79bEZPX525GsWEOyxLbVcr4IjDAvWjLJFuqCE/7GSsnpzs8JpJsxpyO82uY/kqRk6 X-Received: by 2002:a17:906:2344:: with SMTP id m4mr1474146eja.70.1604049713051; Fri, 30 Oct 2020 02:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604049713; cv=none; d=google.com; s=arc-20160816; b=Y7zslkDKLhHPjTKEs7tV6ydre7Whqg++8uzR+FPTiuvlq/vUZbc9K9jOq5Ax8LZ/2C dTKLjneJkggnw9C8I6rp74yeDjHPk6/vYGGiYCNn6ejhuM8btn0Zrfo43+0THGAvMiIF yBdz8VkBHW/nkcWry0c31oxmqIs/hhxlerCGVyx7OFGx63RcJQrTWohfboR8vgVpIRck 1OE9Xk6sfvCW1nzBB/HOXskx6KWdieFJ6tTOpph4Uqu++gbDbhSBKwKde8CLjbTaTzqR UUVtDfJkr2TuTZEeUadAvB7nRF8wfu8w+4/aRTe3O/zjidHFC57p2/YxInri2xJpO+kK DU6A== 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:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=lQ4KBfib0ccEaGKQpjcrLjst4wBoAQNNRSPstCq2R1o=; b=mCsWNWn33EDJ+ufVpvIBax6+xY/g/EEyP4+8JDL+FE+AgnS0ND/VJkczmBhwpS2UFG Inq+iJN3mOI5kH+ZZLwReB4ozKdjHB9mWL0aSCLsJHFquph9e8TpCTJ6lKZe+tupbRvb J8Rd6PnCxhhisLUX0RWj0D4BheMmE2IRD/GFgbtSPYfvvw2ANMn8BEMRPDAxLkm/QAOx db9zKDlcTFvQ2xM9R6qkjXELtTvlvHf+19SDaHo4YMOd+Of+x9Ad9lZym6sLAcw/JiUP Su8qgoS4cdKZiJfO/IwzSdWYIW/p68VmbyoA1gKKgMQe1/MmbFtYKElc5FLRGE90/HD0 zl0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ozXyMct5; 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 o6si3614462eju.647.2020.10.30.02.21.29; Fri, 30 Oct 2020 02:21:53 -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=ozXyMct5; 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 S1726240AbgJ3JVG (ORCPT + 99 others); Fri, 30 Oct 2020 05:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbgJ3JVF (ORCPT ); Fri, 30 Oct 2020 05:21:05 -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 848C7C0613D6 for ; Fri, 30 Oct 2020 02:11:19 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id w189so3444325qkd.6 for ; Fri, 30 Oct 2020 02:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=lQ4KBfib0ccEaGKQpjcrLjst4wBoAQNNRSPstCq2R1o=; b=ozXyMct52rtlS4r0vot7vhWWI5f0No9Nx8v/Gf8IwXUnU0kCORoSpLWZcjX8/sqKV9 cobtlSbWrgJAbigHZ86OsKG4FUoiLPlXx/sHq7rR4bWBJ5LZOZd7MKopL6CGQGAd9ruT ukDzZo9ZXOZADxsxMPycoohjV5jUb79O+K913Gsre0hJNsGwm5u0qOiqZ+qTQgmh5Ce1 6+cPvyumTzO1FOv/Xuj81MVuZnRyivbuaqc64lzKyCGPPaLZfzfl0zmi90rl/7o1gKet PT4rhdDGf6t+UkBpaeuQlzLdNTei4Y4yYpzmKFBfi2JQ7trW7jnLtI75p0TWk9Gx0xmu bgAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lQ4KBfib0ccEaGKQpjcrLjst4wBoAQNNRSPstCq2R1o=; b=F3AmQxuWrw19JN8Am4PgA4Lf1NwylMx/pVn3stGlEad3pFvKE/p+KcYInNYUyjkYq6 W63knNZM/bQHGS1DInznF1MY5Oz+0h05XE5zEdPF+apaTuapAmuu42On2ZGG+9Gm/o/K lSTfAaXIfyN/5/DL8V0EPmW/2ERSIPT9bxss9EAWdhSFUf92lqD8O0BJhPxQsqj6aISf GMB/arOEvd4n5mdlm3etsRhh0R9pUFvljQOFz2xIVVELZjV2ZhlT/kjXoLhVmehaX0Vw 8UpDwQYikutLUnCRfwTfCpyJGxReJCri9XldfRp848l6slWr9bi+515UWQGfz2VXH42n xFQw== X-Gm-Message-State: AOAM533qDUoiz8vKBos2ParzpPT/0IY903GIilpcKjM/+AmSsroGeAfp WLMcKHFmchhpiJpUmeO6Ven+EPscUne924yJzsdeacKkNlBuEhFMxL6YoCwT1QTPZSjN0hYTb6t xmBOg7oHOnki1uD/3NQAmDT14zWpapyoZ/OzXv+yly1rOMUQ1f0NofW+JAFXv9kbt7Pak8eVO0a 08oEE7QN8PB9M= Sender: "howardchung via sendgmr" X-Received: from howardchung-p920.tpe.corp.google.com ([2401:fa00:1:10:f693:9fff:fef4:4e45]) (user=howardchung job=sendgmr) by 2002:a0c:9064:: with SMTP id o91mr8418367qvo.28.1604049078700; Fri, 30 Oct 2020 02:11:18 -0700 (PDT) Date: Fri, 30 Oct 2020 17:11:02 +0800 In-Reply-To: <20201030170932.BlueZ.v2.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid> Message-Id: <20201030170932.BlueZ.v2.3.I22eddcf44e1bec5295c2e162c0477347d2194958@changeid> Mime-Version: 1.0 References: <20201030170932.BlueZ.v2.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [BlueZ PATCH v2 3/3] core: Fix mistakes of using mgmt_tlv_add_fixed From: Howard Chung To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, mmandlik@chromium.org, mcchou@chromium.org, alainm@chromium.org, Howard Chung Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Fix mistakes on checking the result of mgmt_tlv_add_fixed. --- (no changes since v1) src/adapter.c | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index c7b2e0233639..f4d05f3731df 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -4187,157 +4187,157 @@ static void load_default_system_params(struct btd_adapter *adapter) } if (btd_opts.defaults.br.page_scan_win) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0002, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0002, &btd_opts.defaults.br.page_scan_win)) goto done; } if (btd_opts.defaults.br.scan_type != 0xFFFF) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0003, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0003, &btd_opts.defaults.br.scan_type)) goto done; } if (btd_opts.defaults.br.scan_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0004, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0004, &btd_opts.defaults.br.scan_interval)) goto done; } if (btd_opts.defaults.br.scan_win) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0005, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0005, &btd_opts.defaults.br.scan_win)) goto done; } if (btd_opts.defaults.br.link_supervision_timeout) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0006, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0006, &btd_opts.defaults.br.link_supervision_timeout)) goto done; } if (btd_opts.defaults.br.page_timeout) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0007, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0007, &btd_opts.defaults.br.page_timeout)) goto done; } if (btd_opts.defaults.br.min_sniff_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0008, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0008, &btd_opts.defaults.br.min_sniff_interval)) goto done; } if (btd_opts.defaults.br.max_sniff_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0009, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0009, &btd_opts.defaults.br.max_sniff_interval)) goto done; } if (btd_opts.defaults.le.min_adv_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000a, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000a, &btd_opts.defaults.le.min_adv_interval)) goto done; } if (btd_opts.defaults.le.max_adv_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000b, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000b, &btd_opts.defaults.le.max_adv_interval)) goto done; } if (btd_opts.defaults.le.adv_rotation_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000c, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000c, &btd_opts.defaults.le.adv_rotation_interval)) goto done; } if (btd_opts.defaults.le.scan_interval_autoconnect) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000d, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000d, &btd_opts.defaults.le.scan_interval_autoconnect)) goto done; } if (btd_opts.defaults.le.scan_win_autoconnect) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000e, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000e, &btd_opts.defaults.le.scan_win_autoconnect)) goto done; } if (btd_opts.defaults.le.scan_interval_suspend) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000f, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000f, &btd_opts.defaults.le.scan_interval_suspend)) goto done; } if (btd_opts.defaults.le.scan_win_suspend) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0010, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0010, &btd_opts.defaults.le.scan_win_suspend)) goto done; } if (btd_opts.defaults.le.scan_interval_discovery) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0011, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0011, &btd_opts.defaults.le.scan_interval_discovery)) goto done; } if (btd_opts.defaults.le.scan_win_discovery) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0012, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0012, &btd_opts.defaults.le.scan_win_discovery)) goto done; } if (btd_opts.defaults.le.scan_interval_adv_monitor) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0013, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0013, &btd_opts.defaults.le.scan_interval_adv_monitor)) goto done; } if (btd_opts.defaults.le.scan_win_adv_monitor) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0014, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0014, &btd_opts.defaults.le.scan_win_adv_monitor)) goto done; } if (btd_opts.defaults.le.scan_interval_connect) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0015, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0015, &btd_opts.defaults.le.scan_interval_connect)) goto done; } if (btd_opts.defaults.le.scan_win_connect) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0016, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0016, &btd_opts.defaults.le.scan_win_connect)) goto done; } if (btd_opts.defaults.le.min_conn_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0017, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0017, &btd_opts.defaults.le.min_conn_interval)) goto done; } if (btd_opts.defaults.le.max_conn_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0018, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0018, &btd_opts.defaults.le.max_conn_interval)) goto done; } if (btd_opts.defaults.le.conn_latency) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0019, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0019, &btd_opts.defaults.le.conn_latency)) goto done; } if (btd_opts.defaults.le.conn_lsto) { - if (mgmt_tlv_add_fixed(tlv_list, 0x001a, + if (!mgmt_tlv_add_fixed(tlv_list, 0x001a, &btd_opts.defaults.le.conn_lsto)) goto done; } if (btd_opts.defaults.le.autoconnect_timeout) { - if (mgmt_tlv_add_fixed(tlv_list, 0x001b, + if (!mgmt_tlv_add_fixed(tlv_list, 0x001b, &btd_opts.defaults.le.autoconnect_timeout)) goto done; } -- 2.29.1.341.ge80a0c044ae-goog