[genode] bug report on nic_bridge

Stefan Kalkowski stefan.kalkowski at ...1...
Tue Jan 22 10:33:05 CET 2013


Hi Jaeyong,

that's a good point! Thank you for pointing to this. I've opened an
issue accordingly:

  https://github.com/genodelabs/genode/issues/628

Regards
Stefan

On 01/22/2013 01:22 AM, jaeyong yoo wrote:
> Hello Genode,
> 
> I think I found a bug on nic_bridge. Just briefly, nic_bridge uses
> memcmp to maintain avl_tree for clients, but genode memcmp impl. is not
> fully c-standard compatible.
> 
> nic_brdige uses address node which is a avl_tree node that uses
> Genode::memcmp to determine which node is higher:
> os/src/server/nic_bridge/address_node.h:
> 
>                         bool higher(Address_node *c)
>                         {
>                                 using namespace Genode;
> 
>                                 return (memcmp(&c->_addr.addr, &_addr.addr,
>                                                sizeof(_addr.addr)) > 0);
>                         }
> 
> Genode memcmp is not fully c-standard compatible: it only returns 0 or 1.
> base/include/util/string.h:
> 
>         /**
>          * Compare memory blocks
>          *
>          * \retval 0  memory blocks are equal
>          * \retval 1  memory blocks differ
>          *
>          * NOTE: This function is not fully compatible to the C standard.
>          */
>         inline int memcmp(const void *p0, const void *p1, size_t size)
>         {
>                 char *c0 = (char *)p0;
>                 char *c1 = (char *)p1;
> 
>                 size_t i;
>                 for (i = 0; i < size; i++)
>                         if (c0[i] != c1[i]) return 1;
> 
>                 return 0;
>         }
> 
> which makes Address_node avl_tree only grows in one direction (1 side).
> Once the avl_tree is rebalanced, we never reach to the other side (0 side).
> 
> best regards,
> Jaeyong
> 
> 
> ------------------------------------------------------------------------------
> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only - learn more at:
> http://p.sf.net/sfu/learnmore_122512
> 
> 
> 
> _______________________________________________
> Genode-main mailing list
> Genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
> 

-- 
Stefan Kalkowski
Genode Labs

http://www.genode-labs.com/ ยท http://genode.org/




More information about the users mailing list