[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] FW: [PATCH 3/3] Fix austere allocator when small heap list head is NULL


  • To: "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Wed, 25 Feb 2015 10:30:26 +0000
  • Accept-language: en-US
  • Delivery-date: Wed, 25 Feb 2015 10:30:32 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHQUFx0RAoud5FDVEi0P9u9MHkC3Z0BK2NQ
  • Thread-topic: [PATCH 3/3] Fix austere allocator when small heap list head is NULL

Sent to wrong address!

> -----Original Message-----
> From: Owen Smith [mailto:owen.smith@xxxxxxxxxx]
> Sent: 24 February 2015 18:05
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith
> Subject: [PATCH 3/3] Fix austere allocator when small heap list head is NULL
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> ---
>  src/xencrsh/austere.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/xencrsh/austere.c b/src/xencrsh/austere.c index
> 6851475..e00a329 100644
> --- a/src/xencrsh/austere.c
> +++ b/src/xencrsh/austere.c
> @@ -130,7 +130,7 @@ retry:
> 
>      Res = (PVOID)(AustereHeap.BigHeapStart + i * PAGE_SIZE);
>      if (AustereHeap.HeapBlockSizes[i] != (NumPages | FREE_CHUNK)) {
> -        if (i + NumPages <= AUSTERE_HEAP_PAGES)
> +        if (i + NumPages != AUSTERE_HEAP_PAGES)
>              AustereHeap.HeapBlockSizes[i + NumPages] =
> AustereHeap.HeapBlockSizes[i] - NumPages;
>      }
>      AustereHeap.HeapBlockSizes[i] = NumPages; @@ -262,7 +262,8 @@
> __AllocSmall(
>              SubHeap->Next->Prev = SubHeap->Prev;
>          SubHeap->Prev = NULL;
>          SubHeap->Next = AustereHeap.HeadSubHeap;
> -        AustereHeap.HeadSubHeap->Prev = SubHeap;
> +        if (AustereHeap.HeadSubHeap)
> +            AustereHeap.HeadSubHeap->Prev = SubHeap;
>          AustereHeap.HeadSubHeap = SubHeap;
>      }
>      return Res;
> @@ -328,7 +329,8 @@ __FreeSmall(
>              SubHeap->Next->Prev = SubHeap->Prev;
>          SubHeap->Prev = NULL;
>          SubHeap->Next = AustereHeap.HeadSubHeap;
> -        AustereHeap.HeadSubHeap->Prev = SubHeap;
> +        if (AustereHeap.HeadSubHeap)
> +            AustereHeap.HeadSubHeap->Prev = SubHeap;
>          AustereHeap.HeadSubHeap = SubHeap;
>      }
>  }
> @@ -379,6 +381,9 @@ __AustereAllocate(
>  {
>      PVOID   Res;
> 
> +    if (Size < sizeof(PVOID))
> +        Size = sizeof(PVOID);
> +
>      if (Size > AUSTERE_MAX_ALLOC_SIZE) {
>          LogError("%s failing alloc of %d bytes (%d maximum)\n", Caller, Size,
> AUSTERE_MAX_ALLOC_SIZE);
>          return NULL;
> --
> 1.9.4.msysgit.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.