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

Re: [Minios-devel] [UNIKRAFT PATCH 1/1] lib/vfscore: Fix wrong round_page formula



Hey Costin,

I think essentials.h would be a great fit for those macros. What do you 
think?

Regards,

Vlad

On 4/21/19 2:17 PM, Costin Lupu wrote:
> Hi Vlad,
>
> We already have round_pgup() and round_pgdown() macros in
> lib/ukallocbbuddy/bbuddy.c . So maybe it would be better to move them in
> a header which would be included by all sources needing it.
>
> Costin
>
> On 4/20/19 1:55 AM, Vlad-Andrei BĂDOIU (78692) wrote:
>> The code taken from OSv has the PAGE_MASK defined
>> as (PAGE_SIZE-1) whereas we have it defined as
>> (~((__PAGE_SIZE) - 1)). This causes end_pos to
>> be < new_size an such we're not allocating enough
>> memory for the file (new_size should always be
>> bigger than end_pos since're we're round upwards).
>>
>> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
>> ---
>>   lib/vfscore/include/vfscore/prex.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/vfscore/include/vfscore/prex.h 
>> b/lib/vfscore/include/vfscore/prex.h
>> index bfa95655..c27a1262 100644
>> --- a/lib/vfscore/include/vfscore/prex.h
>> +++ b/lib/vfscore/include/vfscore/prex.h
>> @@ -43,7 +43,7 @@
>>   
>>   #define DO_RDWR            0x2
>>   
>> -#define round_page(x)       (((x) + __PAGE_MASK) & ~__PAGE_MASK)
>> +#define round_page(x)       (((x) + __PAGE_SIZE - 1) & ~(__PAGE_SIZE - 1))
>>   
>>   size_t strlcat(char *dst, const char *src, size_t siz);
>>   size_t strlcpy(char *dst, const char *src, size_t siz);
>>
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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