]> asedeno.scripts.mit.edu Git - linux.git/commit
IB/core: uverbs copy to struct or zero helper
authorMichael Guralnik <michaelgur@mellanox.com>
Sun, 9 Dec 2018 09:58:04 +0000 (11:58 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 20 Dec 2018 22:18:18 +0000 (15:18 -0700)
commit2e8039c656224b4a21e1947f45946d32a59bae53
tree90738b202e103845640916c727fae63559901aca
parentf55c3ec42a97bca408f0208ec08e3382340c7be7
IB/core: uverbs copy to struct or zero helper

Add a helper to zero fill fields before copying data to
UVERBS_ATTR_STRUCT.

As UVERBS_ATTR_STRUCT can be used as an extensible struct, we want to make
sure that if the user supplies us with a struct that has new fields that
we are not aware of, we return them zeroed to the user.

This helper should be used when using UVERBS_ATTR_STRUCT for an extendable
data structure and there is a need to make sure that extended members of
the struct, that the kernel doesn't handle, are returned zeroed to the
user. This is needed due to the fact that UVERBS_ATTR_STRUCT allows
non-zero values for members after 'last' member.

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/uverbs_ioctl.c
include/rdma/uverbs_ioctl.h