diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2023-05-22 19:35:59 -0600 |
---|---|---|
committer | Alexander Gordeev <agordeev@linux.ibm.com> | 2023-06-01 17:07:56 +0200 |
commit | d933e5f41e4f6c54f4bd3e0b29ca4854fe5fa0d6 (patch) | |
tree | 6881bf88fdb6cb409cb37f9d7f3739a256bf351e | |
parent | 5dd4241964c86e866ae51b5c5b95cd14c5f341e6 (diff) | |
download | linux-stable-d933e5f41e4f6c54f4bd3e0b29ca4854fe5fa0d6.tar.gz linux-stable-d933e5f41e4f6c54f4bd3e0b29ca4854fe5fa0d6.tar.bz2 linux-stable-d933e5f41e4f6c54f4bd3e0b29ca4854fe5fa0d6.zip |
vfio/ccw: use struct_size() helper
Prefer struct_size() over open-coded versions.
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Link: https://lore.kernel.org/r/f657276073630e806e69726a40ad1cc85101448a.1684805398.git.gustavoars@kernel.org
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-rw-r--r-- | drivers/s390/cio/vfio_ccw_drv.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c index 57906a9c6324..43601816ea4e 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -171,8 +171,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) return -ENODEV; } - parent = kzalloc(sizeof(*parent) + sizeof(struct mdev_type *), - GFP_KERNEL); + parent = kzalloc(struct_size(parent, mdev_types, 1), GFP_KERNEL); if (!parent) return -ENOMEM; |