diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-12-03 10:15:00 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-12-03 10:44:11 -0500 |
commit | bafff1743f2b1bda24daba29c59f755aa2d505b7 (patch) | |
tree | 8c8a71dbcce99beaf8a93773491e34e38318a3f1 /arch/s390 | |
parent | 4118fee78dabb138b548bd42694f3437a8830b60 (diff) |
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/pci/pci_dma.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c index de48625b3590..c64b4b294b0a 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c | |||
@@ -193,12 +193,13 @@ static void dma_free_seg_table(unsigned long entry) | |||
193 | 193 | ||
194 | static void dma_cleanup_tables(struct zpci_dev *zdev) | 194 | static void dma_cleanup_tables(struct zpci_dev *zdev) |
195 | { | 195 | { |
196 | unsigned long *table = zdev->dma_table; | 196 | unsigned long *table; |
197 | int rtx; | 197 | int rtx; |
198 | 198 | ||
199 | if (!zdev || !zdev->dma_table) | 199 | if (!zdev || !zdev->dma_table) |
200 | return; | 200 | return; |
201 | 201 | ||
202 | table = zdev->dma_table; | ||
202 | for (rtx = 0; rtx < ZPCI_TABLE_ENTRIES; rtx++) | 203 | for (rtx = 0; rtx < ZPCI_TABLE_ENTRIES; rtx++) |
203 | if (reg_entry_isvalid(table[rtx])) | 204 | if (reg_entry_isvalid(table[rtx])) |
204 | dma_free_seg_table(table[rtx]); | 205 | dma_free_seg_table(table[rtx]); |