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

Commit bafff174 authored by Wei Yongjun's avatar Wei Yongjun Committed by Martin Schwidefsky
Browse files

s390/pci: fix potential NULL pointer dereference in dma_free_seg_table()



The dereference to 'zdev' should be moved below the NULL test.

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 4118fee7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -193,12 +193,13 @@ static void dma_free_seg_table(unsigned long entry)

static void dma_cleanup_tables(struct zpci_dev *zdev)
{
	unsigned long *table = zdev->dma_table;
	unsigned long *table;
	int rtx;

	if (!zdev || !zdev->dma_table)
		return;

	table = zdev->dma_table;
	for (rtx = 0; rtx < ZPCI_TABLE_ENTRIES; rtx++)
		if (reg_entry_isvalid(table[rtx]))
			dma_free_seg_table(table[rtx]);