agp: Use kcalloc() as a hardening measure
Subsystems (2)
PATCH 1/1 agp: Use kcalloc() as a hardening measure
The advantage of the kcalloc() function is that it checks for integer overflows. We should use it where ever possible as a safety measure. Plus it is nicer for style reasons as well.
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/char/agp/frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/agp/frontend.c +1 -1
@@ -167,7 +167,7 @@ int agp_create_segment(struct agp_client *client, struct agp_region *region)struct agp_segment *user_seg;size_t i; - seg =kzalloc ((sizeof (struct agp_segment_priv ) * region->seg_count),GFP_KERNEL ); + seg =kcalloc (region->seg_count,sizeof (struct agp_segment_priv ),GFP_KERNEL );if (seg ==NULL ) {kfree (region->seg_list); region->seg_list =NULL ;
Signature · 1 line
2.20.1