Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp769709ybh; Sat, 3 Aug 2019 09:24:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXX+ZkZGbXZGP/4DTJOVldYm9GvJnkK2HBKbvm5xPAxGZHNyNzWReJKg6A0d8YvJdXIcvf X-Received: by 2002:a17:902:6847:: with SMTP id f7mr133973250pln.311.1564849447828; Sat, 03 Aug 2019 09:24:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564849447; cv=none; d=google.com; s=arc-20160816; b=t7UiFNkryqak+jYjJjvRU6yPtyE5o2Qy1btxF5LEsgbZ+rO6Y45Xs0042Y9mriMf5g 5Se1CCRf/4At7rTLeoLfgwSEf0BLwaRnJWGWXeRg7QpPsQVk4qXaQehAbYJPc/WGcyg7 ETCkJnu4+aWLFYkcJOTnGAYeQQA5InJtQhIG5v7NiX5F9Fbm4ck90iUEk3/fBv2KFHqG Qd6rjekAMD7S9UxAYmsxMmKAOzulYf29nqEOTGwsWZHSC5G4wUl/P9wLS7YSTQJyjzXh bR6pmjSsQsSGW7+l25svv1tqjEcDmbav/vu7On/YRoFZAW66BIFMGcVw9DeB4+gf9vyA Ccxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=Zxlybz2DrAreBUG46vUr4Lh24574pktraowLMiv39Vk=; b=rjt+61Q/sQRYgPH6pbvHyJXkheM2zyqUgirNJz+T7A+IRlguTDfhZ4JIqSfLr1G/K1 5qJO6gspn/mLIxwpZja6jmEdjtaw01LK9KoEbt/h7Y1nh2bHeIkO5QtM/KRz6EjiDxKe UzclFe4JonqN7AootmWdNr7JkgEol9jws+9oY9aZNyLLZ1smkUP74tZFqW8pe/p+89Om ZaRUa4OlCYN/xjr3SozVf2hz+HMV/XDUUDFHUgE2WVGJBYv7239W3wfVmMavsu/YqTBj oqgTKj/GD7u72CqG4NKkeVBBhPP/Mw8AscBNnf2um1OrwdoRuQFESjNoJ1v9pvNDhBcu uHqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=EzOBANlq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si40477207pfm.145.2019.08.03.09.23.51; Sat, 03 Aug 2019 09:24:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=EzOBANlq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404735AbfHBRXm (ORCPT + 99 others); Fri, 2 Aug 2019 13:23:42 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37893 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404689AbfHBRXl (ORCPT ); Fri, 2 Aug 2019 13:23:41 -0400 Received: by mail-pf1-f193.google.com with SMTP id y15so36373607pfn.5; Fri, 02 Aug 2019 10:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Zxlybz2DrAreBUG46vUr4Lh24574pktraowLMiv39Vk=; b=EzOBANlqiE9wIDomd0Wm6GYWf81TArMo+XXrHAYM6K0xDbXsyOE6DpM7xLb5e7jdCI dlZVBdW5e9NyrMDwDjaSV95zLmtEl2pNWZP47mGuglFmLnuczyePjXYWeEuuqCYbDrm4 EJYLVYbDBdbXHebepSP0fRL899Qst/7KK/c7UAuAK53/lKHDYPjk8gJrQOyBtz+TzTDp oQ7Zi5q4XmKJjRMMMgVwKxg0i9yAnkB75hVUZ/6XeL3QjgF2IkqJcylOw31zf0G8Ql9B 5CWKA1WcSBJH/iCJ+B4Wfv5ldiZx0KGVAry29mIOnF+u9bNY6RNCKzv2YY/0Zz+bBMYn 5h+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Zxlybz2DrAreBUG46vUr4Lh24574pktraowLMiv39Vk=; b=CzdlLpB+yxZKQR5NsIKNaUNFvlTzdng2lheMH87RlesK575sbENR2Ssxx1KhssDSZe HDnAty3H0/rhGyNQ7gdbPHXI0xFTKrAkns1OR+7bO6bJCzz4RU1n2XnfnAzRT2empWbi 2htCKgRZZ8pY6EbTJE06V0K4HehBFexzu1RirsZI0rIIgEIGKt3hJBCG1+JTM191YW4W r8rsQXbUdWHyeeGABsveelaWUBaSIaaOgu6F2Vs32o2mb6IF5hXLORVUzMCev0iaAttI 9xTCc9mECZEmtgw1csobFCvaoyf4wuNT5+LU1NSTnd8Zl9f7Hm4CzeSpzXdMJRFWi/yg Q5HQ== X-Gm-Message-State: APjAAAUoU6nxyyTjza2fTjAe6+hvxmkno45xGLtcW6QrlxvlnQKW4M09 6sVqwOpN7YhRRKH+LGO2o1g= X-Received: by 2002:a62:e710:: with SMTP id s16mr62645808pfh.183.1564766620741; Fri, 02 Aug 2019 10:23:40 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id y23sm77760479pfo.106.2019.08.02.10.23.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 10:23:39 -0700 (PDT) From: Chuhong Yuan Cc: Saeed Mahameed , Leon Romanovsky , "David S . Miller" , Doug Ledford , Jason Gunthorpe , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH v2 0/3] Use refcount_t for refcount Date: Sat, 3 Aug 2019 01:23:34 +0800 Message-Id: <20190802172334.8305-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reference counters are preferred to use refcount_t instead of atomic_t. This is because the implementation of refcount_t can prevent overflows and detect possible use-after-free. First convert the refcount field to refcount_t in mlx5/driver.h. Then convert the uses to refcount_() APIs. Changelog: v1 -> v2: - Add #include in include/linux/mlx5/driver.h. Chuhong Yuan (3): mlx5: Use refcount_t for refcount net/mlx5: Use refcount_() APIs IB/mlx5: Use refcount_() APIs drivers/infiniband/hw/mlx5/srq_cmd.c | 6 +++--- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 6 +++--- include/linux/mlx5/driver.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) -- 2.20.1