Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f47edc6d authored by Roel Kluin's avatar Roel Kluin Committed by Li Yang
Browse files

fsldma: fix check on potential fdev->chan[] overflow



Fix the check of potential array overflow when using corrupted channel
device tree nodes.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarLi Yang <leoli@freescale.com>
parent 0899d634
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -830,7 +830,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev,
			new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1);
			new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1);


	new_fsl_chan->id = ((new_fsl_chan->reg.start - 0x100) & 0xfff) >> 7;
	new_fsl_chan->id = ((new_fsl_chan->reg.start - 0x100) & 0xfff) >> 7;
	if (new_fsl_chan->id > FSL_DMA_MAX_CHANS_PER_DEVICE) {
	if (new_fsl_chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) {
		dev_err(fdev->dev, "There is no %d channel!\n",
		dev_err(fdev->dev, "There is no %d channel!\n",
				new_fsl_chan->id);
				new_fsl_chan->id);
		err = -EINVAL;
		err = -EINVAL;