PDK-9285: IPC: Fix KW issues
authorAngela Stegmaier <angelabaker@ti.com>
Fri, 29 Jan 2021 23:52:34 +0000 (17:52 -0600)
committerAnkur <ankurbaranwal@ti.com>
Thu, 11 Mar 2021 06:45:19 +0000 (00:45 -0600)
Fix KW issues for AM64X IPC and MB build.

Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
packages/ti/drv/ipc/src/ipc_mailbox_lld.c
packages/ti/drv/mailbox/soc/am64x/mailbox_soc.c

index 7d208934566f2647c3d0ee7f4c8139e38291f724..463be433df449c9b7534e2caa301637831fbdd2e 100644 (file)
@@ -404,7 +404,7 @@ void Ipc_mailboxInternalCallback(Mbox_Handle handle, Mailbox_Instance remoteEndp
 
     if (ret == MAILBOX_SOK)
     {
-        if (g_ipc_mBoxData[remoteProcId].func)
+        if ((remoteProcId < IPC_MAX_PROCS) && (g_ipc_mBoxData[remoteProcId].func))
         {
             (g_ipc_mBoxData[remoteProcId].func)(&msg, g_ipc_mBoxData[remoteProcId].arg);
         }
@@ -413,7 +413,7 @@ void Ipc_mailboxInternalCallback(Mbox_Handle handle, Mailbox_Instance remoteEndp
             SystemP_printf("Ipc_mailboxInternalCallback: callback for procId %d with NULL func!\n", remoteProcId);
         }
     }
-    else
+    else if (remoteProcId < IPC_MAX_PROCS)
     {
         g_ipc_mBoxData[remoteProcId].noMsgCnt++;
     }
index be31a8ee1c6593ed22cbbd5ce87718be81bae157..3ae95e844c921558593472c6f5827054b436de6b 100644 (file)
@@ -446,6 +446,10 @@ int32_t Mailbox_write(Mbox_Handle handle, const uint8_t *buffer, uint32_t size)
         {
             retVal = MAILBOX_EINVAL;
         }
+        else if (buffer == NULL)
+        {
+            retVal = MAILBOX_EINVAL;
+        }
         else
         {
             hwCfg = (Mailbox_HwCfg *)driver->hwCfg;