Skip to content

Commit

Permalink
s390/pci: fix potential NULL pointer dereference in dma_free_seg_table()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Yongjun authored and Martin Schwidefsky committed Dec 3, 2012
1 parent 4118fee commit bafff17
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/s390/pci/pci_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit bafff17

Please sign in to comment.