[PATCH v4] usb: gadget: udc: remove pointer dereference after free

From: Gustavo A. R. Silva
Date: Fri Mar 10 2017 - 16:39:48 EST


Remove pointer dereference after free.

Addresses-Coverity-ID: 1091173
Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>
Signed-off-by: Gustavo A. R. Silva <garsilva@xxxxxxxxxxxxxx>
---
Changes in v2:
Move pointer dereference before pci_pool_free()
Set pointer to NULL after free

Changes in v3:
Remove 'td->next = 0x00' inside for loop.
Remove unnecessary pointer nullification after free.

Changes in v4:
Fix line-wrapping in previous patch.

drivers/usb/gadget/udc/pch_udc.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
index a97da64..8a365aa 100644
--- a/drivers/usb/gadget/udc/pch_udc.c
+++ b/drivers/usb/gadget/udc/pch_udc.c
@@ -1523,7 +1523,6 @@ static void pch_udc_free_dma_chain(struct pch_udc_dev *dev,
td = phys_to_virt(addr);
addr2 = (dma_addr_t)td->next;
pci_pool_free(dev->data_requests, td, addr);
- td->next = 0x00;
addr = addr2;
}
req->chain_len = 1;
--
2.5.0