mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
greybus: svc: use kzalloc_flex
Avoid manual sizeof math by using the proper helper. Also use struct_size for the buffer size. Signed-off-by: Rosen Penev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
1 parent
41837c1dea
commit
8ca3d3b1c3
1 file changed
+2
-3
@@ -775,10 +775,9 @@ static void gb_svc_pwrmon_debugfs_init(struct gb_svc *svc)
|
||||
if (!rail_count || rail_count > GB_SVC_PWRMON_MAX_RAIL_COUNT)
|
||||
goto err_pwrmon_debugfs;
|
||||
|
||||
bufsize = sizeof(*rail_names) +
|
||||
GB_SVC_PWRMON_RAIL_NAME_BUFSIZE * rail_count;
|
||||
bufsize = struct_size(rail_names, name, rail_count);
|
||||
|
||||
rail_names = kzalloc(bufsize, GFP_KERNEL);
|
||||
rail_names = kzalloc_flex(*rail_names, name, rail_count);
|
||||
if (!rail_names)
|
||||
goto err_pwrmon_debugfs;
|
||||
|
||||
|
||||
Reference in new issue
Block a user