]> git.baikalelectronics.ru Git - kernel.git/commit
IB/hfi1: Use kzalloc() for mmu_rb_handler allocation
authorMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Mon, 29 Mar 2021 13:54:14 +0000 (09:54 -0400)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 7 Apr 2021 23:19:01 +0000 (20:19 -0300)
commit1cd804c380dd6c1f6155bb520758cc47286e45f2
treee66ca6616eac837879665590b65924415c0fe4a3
parentf53a3a98d387cfecf5d8855cc45ec434c3a46360
IB/hfi1: Use kzalloc() for mmu_rb_handler allocation

The code currently assumes that the mmu_notifier struct
embedded in mmu_rb_handler only contains two fields.

There are now extra fields:

struct mmu_notifier {
        struct hlist_node hlist;
        const struct mmu_notifier_ops *ops;
        struct mm_struct *mm;
        struct rcu_head rcu;
        unsigned int users;
};

Given that there in no init for the mmu_notifier, a kzalloc() should
be used to insure that any newly added fields are given a predictable
initial value of zero.

Fixes: 2d4fda3d466b ("IB/hfi1: Re-factor MMU notification code")
Link: https://lore.kernel.org/r/1617026056-50483-9-git-send-email-dennis.dalessandro@cornelisnetworks.com
Reviewed-by: Adam Goldman <adam.goldman@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hfi1/mmu_rb.c