All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Frederik Bayart <frederik_bayart@yahoo.co.uk>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] rt_heap_alloc size 0 - syscall 7 denied
Date: Wed, 14 Oct 2015 14:41:55 +0200	[thread overview]
Message-ID: <561E4D93.4090803@xenomai.org> (raw)
In-Reply-To: <646804237.361502.1444825285470.JavaMail.yahoo@mail.yahoo.com>

On 10/14/2015 02:21 PM, Frederik Bayart wrote:
>> On Wednesday, 14 October 2015, 12:43, Philippe Gerum <rpm@xenomai.org> wrote:
>> On 10/14/2015 12:22 PM, Frederik Bayart wrote:
>>> Hallo,
>>> I'm using xenomai 3.0 on kernel 3.18.20 (64 bit).
>>>
>>> When using single block heap, I'm getting memory allocation problem when calling rt_heap_alloc with size 0. I don't get the error when calling the function with size used in rt_heap_create.
>>> On the mailing list, I found there has been an issue with this in May : http://www.xenomai.org/pipermail/xenomai/2015-May/034165.html
>>> Is this still an issue ?
>>
>> No, this one is long gone.
>>
>>>
>>> In attachment a test program htest.c + makefile to generate the problem :
>>>
>>> $ sudo ./htest 1  ==> use 0
>>> htest.c:69: heapsize = 70000, usablemem = 70144, usedmem = 0
>>> htest.c:79 ERROR: rt_heap_alloc(-12): Cannot allocate memory
>>>
>>> $ sudo ./htest 1  ==> use same size as in create
>>> htest.c:69: heapsize = 70000, usablemem = 70144, usedmem = 0
>>> htest.c:92: heapsize = 70000, usablemem = 70144, usedmem = 70144
>>>
>>
>> Does this help?
>>
>> diff --git a/lib/alchemy/heap.c b/lib/alchemy/heap.c
>> index 20531e3..146bfa1 100644
>> --- a/lib/alchemy/heap.c
>> +++ b/lib/alchemy/heap.c
>> @@ -442,7 +442,9 @@ int rt_heap_alloc_timed(RT_HEAP *heap,
>>         p = __mptr(hcb->sba);
>>         if (p)
>>             goto done;
>> -        if (size > 0 && size != hcb->size) {
>> +        if (size == 0)
>> +            size = heapobj_size(&hcb->hobj);
>> +        else if (size != hcb->size) {
>>             ret = -EINVAL;
>>             goto done;
>>
>>         }
>>
> 
> After code reading, could it be that the exception for size == 0 has disappeared in the released code ?
> 

Did you try that patch?

-- 
Philippe.


  reply	other threads:[~2015-10-14 12:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 10:22 [Xenomai] rt_heap_alloc size 0 - syscall 7 denied Frederik Bayart
2015-10-14 10:43 ` Philippe Gerum
2015-10-14 12:21   ` Frederik Bayart
2015-10-14 12:41     ` Philippe Gerum [this message]
2015-10-14 16:55       ` Frederik Bayart
2015-10-15  7:56         ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561E4D93.4090803@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=frederik_bayart@yahoo.co.uk \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.