summaryrefslogtreecommitdiff
path: root/drivers/common
diff options
context:
space:
mode:
authorShreyansh Jain <shreyansh.jain@nxp.com>2018-10-17 09:05:57 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-10-25 00:51:05 +0200
commit29ba8d9436fdc284eb4418f95f045a2aea45317a (patch)
treeaa3d591927a08320cdee0103b2b416cd140dab18 /drivers/common
parentfa443893bc65aa709f969b365ba8dca948afa774 (diff)
downloaddpdk-next-eventdev-29ba8d9436fdc284eb4418f95f045a2aea45317a.zip
dpdk-next-eventdev-29ba8d9436fdc284eb4418f95f045a2aea45317a.tar.gz
dpdk-next-eventdev-29ba8d9436fdc284eb4418f95f045a2aea45317a.tar.xz
common/dpaax: fix uninitialized PA-VA table case
There is a possibility that either because of missing device tree entry or lack of memory, the PA-VA table might not be available. But, the table being transparent, the callers don't necessary check for its initialization state. This is explicitly done during update and translation call. Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table") Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Diffstat (limited to 'drivers/common')
-rw-r--r--drivers/common/dpaax/dpaax_iova_table.c3
-rw-r--r--drivers/common/dpaax/dpaax_iova_table.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index d54267b..075053b 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -272,6 +272,9 @@ dpaax_iova_table_update(phys_addr_t paddr, void *vaddr, size_t length)
uintptr_t align_vaddr;
phys_addr_t align_paddr;
+ if (unlikely(dpaax_iova_table_p == NULL))
+ return -1;
+
align_paddr = paddr & DPAAX_MEM_SPLIT_MASK;
align_vaddr = ((uintptr_t)vaddr & DPAAX_MEM_SPLIT_MASK);
diff --git a/drivers/common/dpaax/dpaax_iova_table.h b/drivers/common/dpaax/dpaax_iova_table.h
index 1109a36..138827e 100644
--- a/drivers/common/dpaax/dpaax_iova_table.h
+++ b/drivers/common/dpaax/dpaax_iova_table.h
@@ -74,6 +74,9 @@ dpaax_iova_table_get_va(phys_addr_t paddr) {
size_t offset = paddr & DPAAX_MEM_SPLIT_MASK_OFF;
struct dpaax_iovat_element *entry;
+ if (unlikely(dpaax_iova_table_p == NULL))
+ return NULL;
+
entry = dpaax_iova_table_p->entries;
do {