[ofw][PATCH] [IBBUS][WinVerbs][SDP] Validation of non-zero size when calling to ExAllocatePoolWithTag

Sean Hefty sean.hefty at intel.com
Mon Oct 26 11:22:34 PDT 2009


only commenting on drivers that I maintain

in short, the winmad, winverbs, and index_list changes are not needed.

>Index: D:/windows/MLNX_WinOF_trunk/core/winmad/kernel/wm_driver.c
>===================================================================
>--- D:/windows/MLNX_WinOF_trunk/core/winmad/kernel/wm_driver.c (revision 4987)
>+++ D:/windows/MLNX_WinOF_trunk/core/winmad/kernel/wm_driver.c (revision 4992)
>@@ -238,8 +238,8 @@
>   attr = NULL;
>   goto out;
>  }
>-
>- attr = ExAllocatePoolWithTag(PagedPool, size, 'acmw');
>+
>+ attr = ExAllocatePoolWithTagSafeEx(PagedPool, size, 'acmw');

not needed - size must be > 0 here

>@@ -269,7 +269,8 @@
>  }
>
>  size = sizeof(WM_IB_PORT) * attr->num_ports;
>- pDevice->pPortArray = ExAllocatePoolWithTag(PagedPool, size, 'pimw');
>+
>+ pDevice->pPortArray = ExAllocatePoolWithTagSafeEx(PagedPool, size, 'pimw') ;

not needed - size must be > 0 here

>  if (pDevice->pPortArray == NULL) {
>   status = STATUS_NO_MEMORY;
>   goto out;
>Index: D:/windows/MLNX_WinOF_trunk/core/winverbs/kernel/wv_device.c
>===================================================================
>--- D:/windows/MLNX_WinOF_trunk/core/winverbs/kernel/wv_device.c (revision
>4987)
>+++ D:/windows/MLNX_WinOF_trunk/core/winverbs/kernel/wv_device.c (revision
>4992)
>@@ -178,8 +178,8 @@
>   attr = NULL;
>   goto out;
>  }
>-
>- attr = ExAllocatePoolWithTag(PagedPool, size, 'acvw');
>+
>+ attr = ExAllocatePoolWithTagSafeEx(PagedPool, size, 'acvw');

not needed - size must be > 0 here

>  if (attr == NULL) {
>   goto out;
>  }
>@@ -210,7 +210,7 @@
>  pDevice->PortCount = attr->num_ports;
>  ExFreePoolWithTag(attr, 'acvw');
>
>- pDevice->pPorts = ExAllocatePoolWithTag(NonPagedPool, sizeof(WV_PORT) *
>+ pDevice->pPorts = ExAllocatePoolWithTagSafeEx(NonPagedPool, sizeof(WV_PORT) *

size must be > 0 here

>            pDevice->PortCount, 'cpvw');
>  if (pDevice->pPorts == NULL) {
>   return STATUS_NO_MEMORY;
>Index: D:/windows/MLNX_WinOF_trunk/etc/kernel/index_list.c
>===================================================================
>--- D:/windows/MLNX_WinOF_trunk/etc/kernel/index_list.c (revision 4987)
>+++ D:/windows/MLNX_WinOF_trunk/etc/kernel/index_list.c (revision 4992)
>@@ -28,7 +28,9 @@
>  */
>
> #include "index_list.h"
>+#include <complib/cl_memory.h>

Include not needed 

>
>+
> INDEX_ENTRY EmptyList;
>
> static BOOLEAN IndexListGrow(INDEX_LIST *pIndexList)
>@@ -37,7 +39,8 @@
>  SIZE_T  size, i;
>
>  size = pIndexList->Size + (PAGE_SIZE / sizeof(INDEX_ENTRY));
>- array = ExAllocatePoolWithTag(NonPagedPool, size * sizeof(INDEX_ENTRY),
>'xdni');
>+
>+ array =  ExAllocatePoolWithTagSafeEx(NonPagedPool, size *
>sizeof(INDEX_ENTRY), 'xdni');

not needed - allocated size must be > 0





More information about the ofw mailing list