Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp466631pxp; Fri, 11 Mar 2022 07:51:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjPI3nCnv8yeUbAdOy5Tk08dTObexcIUJHaXZZJy5N5fsc6U1r8yOKlzAy3OLfw1d7mSQq X-Received: by 2002:a63:4e14:0:b0:374:4a37:4966 with SMTP id c20-20020a634e14000000b003744a374966mr8777545pgb.118.1647013877585; Fri, 11 Mar 2022 07:51:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647013877; cv=none; d=google.com; s=arc-20160816; b=GRy65xfLp4s6/3EdibK8Jw7JIRJE96rogox3dMRcqAWyfFHedf8wcinfnYo4UiUcoW PhqIG4oR6vw/cmIJOomCcI5Q8ovgRf9rOiMqR4N6KBSag+Fs8C54Zwn6NhINX1qu/TPF P7W/l8FDxBn8//YwDiVRzvJbA21q+c0X0h9hwgvEJOQVZ2q8YKR1LO+GUSGFaw1M1xAd etoHySZvzuH8q/FW4akpu8hKJkqgt4lePmHxLiRvI8axzA7FsHbsJdJT5efoqX9o748T 2wY8JIfMEhmNGvqmml4yj19iMJ6a7X98XDOfbHxtf1XWX4aPl0Ah9gl2pWNE/WRqgfdZ fUbA== 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=zJPnVIMSU+IrQ9w0O2hqLwzd9dxtAvfXm0oaAs1Cu+o=; b=fCieUG2oCoCWrxhDX8W3I5gURdRZdUAAbnVdzwUi5KvotkgIZvrL0FL+KM/NRiOJ93 Z1EnayzYl0zqsFXnn6F9CW+877t0c/WSEQw/q5L0u2z/ZgssMCT4gOVgsuXX5q5ycVTI Kl1YFyas9fbYZUHJ8TTa4yyA6rhmJkGpJ5wIDjY/frkX4czvti/f7HkLKIyHZYTh6bUP LgNtUDFUBiRgZzP0bx1ffBZIgEDT3C2t3xEwITchD9HSZ2gZNQIrqelXquQe/KuSL5g/ d6CXhSDurhuBrBO1Pu1nT9fhKEQS7b1wYWwi0uGNkcyhxNLqnrJvTR1rpzFQYRZZkH62 HhZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@matician-com.20210112.gappssmtp.com header.s=20210112 header.b=KyHQnFWz; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a636b07000000b003807411bea6si7915781pgc.718.2022.03.11.07.50.46; Fri, 11 Mar 2022 07:51:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@matician-com.20210112.gappssmtp.com header.s=20210112 header.b=KyHQnFWz; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237394AbiCKNlO (ORCPT + 99 others); Fri, 11 Mar 2022 08:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231279AbiCKNlN (ORCPT ); Fri, 11 Mar 2022 08:41:13 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FC5412A75F for ; Fri, 11 Mar 2022 05:40:10 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id o26so7485837pgb.8 for ; Fri, 11 Mar 2022 05:40:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=matician-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zJPnVIMSU+IrQ9w0O2hqLwzd9dxtAvfXm0oaAs1Cu+o=; b=KyHQnFWzijooxhm4+qEClaFTQnEh1kFr5/0X6dBynGp50rRU03p/aEaHySlTcLLpML N0HWi23HXrJPFZNrUjwzzK3VnbpzBrSp9Shhvljosnj3JI/kxNP6wU6pjcuTuZ7dcVjx liJOt/SOw8J6okyDGeurWLW49JV+Eb2j4ZbojSFQP/CyO2g7enBbQoAhFtasV6sUBBIr LX/DHfsT2qlfLFhfQ79u1hsJZIAmNU6Xj1uWDTt/GN+/gw5kiLcNvGYc/DwKztEP2O3J JIV4lrsGnRq2UVntgxzw18B/RVWt9dBeEFW4jeHsj2glVNDlA2kW29O/FgG5Nvpy5jtj adxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zJPnVIMSU+IrQ9w0O2hqLwzd9dxtAvfXm0oaAs1Cu+o=; b=yomQusQ70h4tVZrN+dduG6cJv4+JYvDNluLyzsy2tAaeG4lhuDs+/N7mJu27mbBmaa ZUo1aLXCO0y09E+HDHlyMHaa+wcUNRbDyp2moTqh9UoGYZSHZrf2XNWSFAtMSwn76q2C fg2KDnXpeCw4rT+CbF4HirMI7/FNKV2tGhvZ+GZ5RUNUZrpdMKwh88vrSB8eP+q9GCTl Xckvxeen+2V2ZyGlWImiAkOpw4dLCvyYrgYa+pc7c2jAAXeCimpgXtSIgEXBVxKtAchd MCHu6ogSHUpWHRB3bwA+vQt6SsLC1dx9Cy8+Ion1D1inRQXwHNoA42MITVd5fOnwOXFf agRA== X-Gm-Message-State: AOAM53268ItZ+AW/LS6wrKwkNvlvxzljAewNCxC9l1iPIBMphnOEdPh7 PZ0zWuEUpqdfCJja+5zXpRwAVzogUOO9eJkuyGtsgg== X-Received: by 2002:a63:5c0f:0:b0:374:4a37:48f9 with SMTP id q15-20020a635c0f000000b003744a3748f9mr8659467pgb.470.1647006010014; Fri, 11 Mar 2022 05:40:10 -0800 (PST) MIME-Version: 1.0 References: <20220224100641.2449550-1-gavin@matician.com> <71D25C8F-67D1-4EC0-9160-5F61C832F0AF@holtmann.org> In-Reply-To: From: Gavin Li Date: Fri, 11 Mar 2022 05:39:58 -0800 Message-ID: Subject: Re: [PATCH] Bluetooth: fix incorrect nonblock bitmask in bt_sock_wait_ready() To: Marcel Holtmann Cc: Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Marcel, Please let me know what you think with regards to the comments above. Best, Gavin On Thu, Feb 24, 2022 at 12:56 PM Gavin Li wrote: > > Hi Marcel, > > Thanks for reviewing this quickly. > > > > diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c > > > index ee319779781e6..69374321130e4 100644 > > > --- a/net/bluetooth/af_bluetooth.c > > > +++ b/net/bluetooth/af_bluetooth.c > > > @@ -568,7 +568,7 @@ int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo) > > > EXPORT_SYMBOL(bt_sock_wait_state); > > > > > > /* This function expects the sk lock to be held when called */ > > > -int bt_sock_wait_ready(struct sock *sk, unsigned long flags) > > > +int bt_sock_wait_ready(struct sock *sk, unsigned int flags) > > > > can we then also do s/flags/msg_flags/ then. > I prefer keeping it as flags because all other net code also uses > flags, msg_flags only appears > in msg->msg_flags. > > > > @@ -576,7 +576,7 @@ int bt_sock_wait_ready(struct sock *sk, unsigned long flags) > > > > > > BT_DBG("sk %p", sk); > > > > > > - timeo = sock_sndtimeo(sk, flags & O_NONBLOCK); > > > + timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); > > > > Since sock_sndtimeo() is taking a bool. This might be better !!(flags & MSG_DONTWAIT). > It appears to be well-known in the net code that sock_sndtimeo takes a > bool, since no other > uses of it do the "!!" conversion. > > Let me know what you think. I can make the changes if needed but I was > just trying my best > to match the currently existing convention. > > Best, > Gavin