missbit=tkey_extract_bits(key, newpos, 1); 
missbit = tkey_extract_bits(key, newpos, 1); 
fib_insert_node(struct trie *t, int *err, u32 key, int plen){	int pos, newpos;	struct tnode *tp = NULL, *tn = NULL;	struct node *n;	struct leaf *l;	int missbit;	struct list_head *fa_head = NULL;	struct leaf_info *li;	t_key cindex;	pos = 0;	n = t->trie;	/* If we point to NULL, stop. Either the tree is empty and we should	 * just put a new leaf in if, or we have reached an empty child slot,	 * and we should just put our new leaf in that.	 * If we point to a T_TNODE, check if it matches our key. Note that	 * a T_TNODE might be skipping any number of bits - its 'pos' need	 * not be the parent's 'pos'+'bits'!	 *	 * If it does match the current key, get pos/bits from it, extract	 * the index from our key, push the T_TNODE and walk the tree.	 *	 * If it doesn't, we have to replace it with a new T_TNODE.	 *	 * If we point to a T_LEAF, it might or might not have the same key	 * as we do. If it does, just change the value, update the T_LEAF's	 * value, and return it.	 * If it doesn't, we need to replace it with a T_TNODE.	 */	while (n != NULL &&  NODE_TYPE(n) == T_TNODE) {		tn = (struct tnode *) n;				check_tnode(tn);			if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) {			tp = tn;			pos=tn->pos + tn->bits;			n = tnode_get_child(tn, tkey_extract_bits(key, tn->pos, tn->bits));			if (n && NODE_PARENT(n) != tn) {				printk("BUG tn=%p, n->parent=%p\n", tn, NODE_PARENT(n));				BUG();			}		}		else			break;	}	/*	 * n  ----> NULL, LEAF or TNODE	 *	 * tp is n's (parent) ----> NULL or TNODE	 */	if (tp && IS_LEAF(tp))		BUG();	/* Case 1: n is a leaf. Compare prefixes */	if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) {		struct leaf *l = ( struct leaf *)  n;			li = leaf_info_new(plen);			if (!li) {			*err = -ENOMEM;			goto err;		}		fa_head = &li->falh;		insert_leaf_info(&l->list, li);		goto done;	}	t->size++;	l = leaf_new();	if (!l) {		*err = -ENOMEM;		goto err;	}	l->key = key;	li = leaf_info_new(plen);	if (!li) {		tnode_free((struct tnode *) l);		*err = -ENOMEM;		goto err;	}	fa_head = &li->falh;	insert_leaf_info(&l->list, li);	/* Case 2: n is NULL, and will just insert a new leaf */	if (t->trie && n == NULL) {		NODE_SET_PARENT(l, tp);			if (!tp)			BUG();		else {			cindex = tkey_extract_bits(key, tp->pos, tp->bits);			put_child(t, (struct tnode *)tp, cindex, (struct node *)l);		}	}	/* Case 3: n is a LEAF or a TNODE and the key doesn't match. */	else {		/*		 *  Add a new tnode here		 *  first tnode need some special handling		 */		if (tp)			pos=tp->pos+tp->bits;		else			pos=0;		if (n) {			newpos = tkey_mismatch(key, pos, n->key);			tn = tnode_new(n->key, newpos, 1);		}		else {			newpos = 0;			tn = tnode_new(key, newpos, 1); /* First tnode */		}		if (!tn) {			free_leaf_info(li);			tnode_free((struct tnode *) l);			*err = -ENOMEM;			goto err;		}						NODE_SET_PARENT(tn, tp);		missbit=tkey_extract_bits(key, newpos, 1);		put_child(t, tn, missbit, (struct node *)l);		put_child(t, tn, 1-missbit, n);		if (tp) {			cindex = tkey_extract_bits(key, tp->pos, tp->bits);			put_child(t, (struct tnode *)tp, cindex, (struct node *)tn);		}		else {			t->trie = (struct node*) tn; /* First tnode */			tp = tn;		}	}	if (tp && tp->pos+tp->bits > 32) {		printk("ERROR tp=%p pos=%d, bits=%d, key=%0x plen=%d\n",		       tp, tp->pos, tp->bits, key, plen);	}	/* Rebalance the trie */	t->trie = trie_rebalance(t, tp);done:	t->revision++;err:;	return fa_head;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/91b9a277fc4d207249e459a455abf804ebb5499d/fib_trie.c/buggy/net/ipv4/fib_trie.c