(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
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
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
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
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
5 matches
Mail list logo