On 16-08-23, 10:03, Yu Liao wrote: > Make use of the struct_size() helper instead of an open-coded version, > in order to avoid any potential type mistakes or integer overflows that, > in the worst scenario, could lead to heap overflows. Duplicate to 923b13838892 ("dmaengine: mcf-edma: Use struct_size()") > > Signed-off-by: Yu Liao <liaoyu15@xxxxxxxxxx> > --- > drivers/dma/mcf-edma.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/dma/mcf-edma.c b/drivers/dma/mcf-edma.c > index 9413fad08a60..444b5c1bd7dc 100644 > --- a/drivers/dma/mcf-edma.c > +++ b/drivers/dma/mcf-edma.c > @@ -180,7 +180,6 @@ static int mcf_edma_probe(struct platform_device *pdev) > { > struct mcf_edma_platform_data *pdata; > struct fsl_edma_engine *mcf_edma; > - struct fsl_edma_chan *mcf_chan; > struct edma_regs *regs; > int ret, i, len, chans; > > @@ -197,7 +196,7 @@ static int mcf_edma_probe(struct platform_device *pdev) > chans = pdata->dma_channels; > } > > - len = sizeof(*mcf_edma) + sizeof(*mcf_chan) * chans; > + len = struct_size(mcf_edma, chans, chans); > mcf_edma = devm_kzalloc(&pdev->dev, len, GFP_KERNEL); > if (!mcf_edma) > return -ENOMEM; > -- > 2.25.1 -- ~Vinod