Message ID | 20220210060845.1608290-1-chi.minghao@zte.com.cn (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [V2] net/802: use struct_size over open coded arithmetic | expand |
diff --git a/net/802/mrp.c b/net/802/mrp.c index 35e04cc5390c..880cb9ed9c4b 100644 --- a/net/802/mrp.c +++ b/net/802/mrp.c @@ -273,7 +273,7 @@ static struct mrp_attr *mrp_attr_create(struct mrp_applicant *app, return attr; } } - attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC); + attr = kmalloc(struct_size(attr, data, len), GFP_ATOMIC); if (!attr) return attr; attr->state = MRP_APPLICANT_VO;