Message ID | 20240626-omap-usb-tll-counted_by-v2-1-4bedf20d1b51@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v2] mfd: omap-usb-tll: use struct_size to allocate tll | expand |
On Wed, 26 Jun 2024 21:37:03 +0200, Javier Carrasco wrote: > Commit 16c2004d9e4d ("mfd: omap-usb-tll: Allocate driver data at once") > changed the memory allocation of 'tll' to consolidate it into a single > allocation, introducing an incorrect size calculation. > > In particular, the allocation for the array of pointers was converted > into a single-pointer allocation. > > [...] Applied, thanks! [1/1] mfd: omap-usb-tll: use struct_size to allocate tll commit: 1938e6882b89d1d01926ed3e0bbdd8346263c317 -- Lee Jones [李琼斯]
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c index b6303ddb013b..f68dd0281463 100644 --- a/drivers/mfd/omap-usb-tll.c +++ b/drivers/mfd/omap-usb-tll.c @@ -230,8 +230,7 @@ static int usbtll_omap_probe(struct platform_device *pdev) break; } - tll = devm_kzalloc(dev, sizeof(*tll) + sizeof(tll->ch_clk[nch]), - GFP_KERNEL); + tll = devm_kzalloc(dev, struct_size(tll, ch_clk, nch), GFP_KERNEL); if (!tll) { pm_runtime_put_sync(dev); pm_runtime_disable(dev);