Skip to contentSkip to conversation

Use refcount_t for refcount

PATCH Superseded Chuhong Yuan 2 participants 2 messages Aug 2, 2019 – Aug 4, 2019

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Use refcount_t for refcount

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(-)
Signature · 1 line
2.20.1
#1 lore raw
Quoted 5 lines · Chuhong Yuan

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.

Quoted 7 lines

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.

The same NAK as for version v0.

Thanks