At 2012-6-1 2:34, Dave Anderson wrote:
So I believe that the 1-bit should be stripped off when a user
inadvertently enters such an address as a -N radix_tree_node address.
With this change to cmd_tree():
if (hexadecimal_only(args[optind], 0)) {
value = htol(args[optind], FAULT_ON_ERROR, NULL);
if (IS_KVADDR(value)) {
td->start = value;
+ if ((td->start& 1)&&
+ (td->flags& TREE_NODE_POINTER)&&
+ (type_flag == RADIXTREE_REQUEST))
+ td->start&= ~1;
goto next_arg;
}
}
it works OK regardless of the 1-bit setting:
Hello Dave,
I have to point out that you only involved the situation that user input
a hexadecimal number. The tree command can get starting address from
three place.
<cut>
if ((sp = symbol_search(args[optind]))) {
td->start = sp->value;
goto next_arg;
}
if (!IS_A_NUMBER(args[optind])) {
if (can_eval(args[optind])) {
value = eval(args[optind], FAULT_ON_ERROR, NULL);
if (IS_KVADDR(value)) {
td->start = value;
goto next_arg;
}
}
error(FATAL, "invalid argument: %s\n", args[optind]);
}
if (hexadecimal_only(args[optind], 0)) {
value = htol(args[optind], FAULT_ON_ERROR, NULL);
if (IS_KVADDR(value)) {
td->start = value;
goto next_arg;
}
}
<cut>
So I prefer change like this.
<cut>
if (td->flags & TREE_NODE_POINTER) {
node_p = td->start;
+
+ if (node_p & 1)
+ node_p &= ~1;
+
if (VALID_MEMBER(radix_tree_node_height)) {
readmem(node_p +
OFFSET(radix_tree_node_height), KVADDR,
&height, sizeof(uint), "radix_tree_node
height",
FAULT_ON_ERROR);
<cut>
--
--
Regards
Qiao Nuohan