[PATCH] block: bio: use struct_size() in kmalloc()

2019-05-17 Thread xiaolinkui
(struct foo) + count * sizeof(struct boo), GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL); Signed-off-by: xiaolinkui --- block/bio.c | 7 ++- 1 file

[PATCH] gpu: drm: use struct_size() in kmalloc()

2019-05-17 Thread xiaolinkui
Use struct_size() helper to keep code simple. Signed-off-by: xiaolinkui --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 22bd21e..4717a64

[PATCH 1/3] lib: assoc_array: use struct_size() in kmalloc()

2019-05-17 Thread xiaolinkui
Use the new struct_size() helper to keep code simple. Signed-off-by: xiaolinkui --- lib/assoc_array.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/assoc_array.c b/lib/assoc_array.c index edc3c14..0e69b5b 100644 --- a/lib/assoc_array.c +++ b/lib/assoc_array.c

[PATCH] arch: s390: use struct_size() in kmalloc()

2019-05-17 Thread xiaolinkui
Use the new struct_size() helper to keep code simple. Signed-off-by: xiaolinkui --- arch/s390/include/asm/idals.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/s390/include/asm/idals.h b/arch/s390/include/asm/idals.h index 15578fd..6fb7ace 100644 --- a/arch/s390

[PATCH] nvme: target: use struct_size() in kmalloc()

2019-05-17 Thread xiaolinkui
entry[]; }; instance = kmalloc(sizeof(struct foo) + count * sizeof(struct boo), GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL); Signed-off-by: xiaolinkui