bus: ti-sysc: Use 2-factor allocator arguments
PATCH 1/1 bus: ti-sysc: Use 2-factor allocator arguments
This adjusts the allocator calls to use 2-factor argument call style, as done treewide already for improved defense against allocation overflows.
--- drivers/bus/ti-sysc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/bus/ti-sysc.c +4 -4
@@ -169,9 +169,9 @@ static int sysc_get_clocks(struct sysc *ddata)const char *name;int nr_fck =0 , nr_ick =0 , i, error =0 ; - ddata->clock_roles =devm_kzalloc (ddata->dev, -sizeof (*ddata->clock_roles) * + ddata->clock_roles =devm_kcalloc (ddata->dev,SYSC_MAX_CLOCKS , +sizeof (*ddata->clock_roles),GFP_KERNEL );if (!ddata->clock_roles)return -ENOMEM ;
@@ -200,8 +200,8 @@ static int sysc_get_clocks(struct sysc *ddata)return -EINVAL ; } - ddata->clocks =devm_kzalloc (ddata->dev, -sizeof (*ddata->clocks) * ddata->nr_clocks, + ddata->clocks =devm_kcalloc (ddata->dev, + ddata->nr_clocks,sizeof (*ddata->clocks),GFP_KERNEL );if (!ddata->clocks)return -ENOMEM ;
Signature · 6 lines
2.17.0 -- Kees Cook Pixel Security
Quoted 4 lines · Kees Cook
This adjusts the allocator calls to use 2-factor argument call style, as done treewide already for improved defense against allocation overflows.
Signed-off-by Kees Cook <[email protected]>
Friendly ping! :) This is the last 2-factor devm* allocation left in 4.18 to be fixed.
Thanks!
-Kees
Quoted 38 lines
--- drivers/bus/ti-sysc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/bus/ti-sysc.c +4
-5@@ -169,9 +169,9 @@ static int sysc_get_clocks(struct sysc *ddata)const char *name;int nr_fck =0 , nr_ick =0 , i, error =0 ; - ddata->clock_roles =devm_kzalloc (ddata->dev, -sizeof (*ddata->clock_roles) * + ddata->clock_roles =devm_kcalloc (ddata->dev,SYSC_MAX_CLOCKS , +sizeof (*ddata->clock_roles),GFP_KERNEL );if (!ddata->clock_roles)return -ENOMEM ;@@ -200,8 +200,8 @@ static int sysc_get_clocks(struct sysc *ddata)return -EINVAL ; } - ddata->clocks =devm_kzalloc (ddata->dev, -sizeof (*ddata->clocks) * ddata->nr_clocks, + ddata->clocks =devm_kcalloc (ddata->dev, + ddata->nr_clocks,sizeof (*ddata->clocks),GFP_KERNEL );if (!ddata->clocks)return -ENOMEM ; --2.17.0
--
Kees Cook
Pixel Security
Signature · 2 lines
Kees Cook Pixel Security
Tony Lindgren
maintainerQuoted 8 lines · Kees Cook
Quoted 4 lines · Kees Cook
This adjusts the allocator calls to use 2-factor argument call style, as done treewide already for improved defense against allocation overflows.
Signed-off-by Kees Cook <[email protected]>Friendly ping! :) This is the last 2-factor devm* allocation left in 4.18 to be fixed.
Sorry for the delay on this one. As we're already at -rc3, I'll apply this into omap-for-v4.19/ti-sysc. Seems there should not be need to rush this into v4.18-rc cycle, but please do let me know if that is not the case.
Regards,
Tony
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Kees Cook
Quoted 4 lines · Kees Cook
This adjusts the allocator calls to use 2-factor argument call style, as done treewide already for improved defense against allocation overflows.
Signed-off-by Kees Cook <[email protected]>
Quoted 7 lines
Quoted 2 lines
Friendly ping! :) This is the last 2-factor devm* allocation left in 4.18 to be fixed.
Sorry for the delay on this one. As we're already at -rc3, I'll apply this into omap-for-v4.19/ti-sysc. Seems there should not be need to rush this into v4.18-rc cycle, but please do let me know if that is not the case.
I'd like to be able to reason about multiplication vs allocator uses in 4.18 and later. Since all other allocators got fixed in 4.18, I'd really like to have this one fixed too, then the scripts that check for multiplications in single-argument allocators will run clean for 4.18.
So, it's not strictly a "rush", but it would be appreciated. :)
-Kees
Signature · 2 lines
Kees Cook Pixel Security
Tony Lindgren
maintainerQuoted 16 lines · Kees Cook
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Kees Cook
Quoted 4 lines · Kees Cook
This adjusts the allocator calls to use 2-factor argument call style, as done treewide already for improved defense against allocation overflows.
Signed-off-by Kees Cook <[email protected]>Quoted 7 lines
Quoted 2 lines
Friendly ping! :) This is the last 2-factor devm* allocation left in 4.18 to be fixed.
Sorry for the delay on this one. As we're already at -rc3, I'll apply this into omap-for-v4.19/ti-sysc. Seems there should not be need to rush this into v4.18-rc cycle, but please do let me know if that is not the case.
Quoted 7 lines
I'd like to be able to reason about multiplication vs allocator uses in 4.18 and later. Since all other allocators got fixed in 4.18, I'd really like to have this one fixed too, then the scripts that check for multiplications in single-argument allocators will run clean for 4.18.
So, it's not strictly a "rush", but it would be appreciated. :)
OK I'll merge that commit also into omap-for-v4.18/fixes branch too.
Regards,
Tony