Skip to contentSkip to conversation

binder: fix offset calculation in debug log

PATCH In review Carlos Llamas 2 participants 2 messages Mar 25, 2025

Subsystems (2)
lore
Share & tools
lore

Carlos Llamas

author maintainer
#0 lore raw

PATCH 1/1 binder: fix offset calculation in debug log

The vma start address should be substracted from the buffer's user data address and not the other way around.

Cc Tiffany Y. Yang <[email protected]>
Fixes 162c79731448 ("binder: avoid user addresses in debug logs")
---
 drivers/android/binder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder.c +1 -1
index 76052006bd87..5fc2c8ee61b1 100644
@@ -6373,7 +6373,7 @@ static void print_binder_transaction_ilocked(struct seq_file *m,
 		seq_printf(m, " node %d", buffer->target_node->debug_id);
 	seq_printf(m, " size %zd:%zd offset %lx\n",
 		   buffer->data_size, buffer->offsets_size,
-		   proc->alloc.vm_start - buffer->user_data);
+		   buffer->user_data - proc->alloc.vm_start);
 }
 
 static void print_binder_work_ilocked(struct seq_file *m,
Signature · 1 line
2.49.0.395.g12beb8f557-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Carlos Llamas

The vma start address should be substracted from the buffer's user data address and not the other way around.

Cc Tiffany Y. Yang <[email protected]>
Fixes 162c79731448 ("binder: avoid user addresses in debug logs")
Quoted 17 lines
---
 drivers/android/binder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder.c +1 -1
index 76052006bd87..5fc2c8ee61b1 100644
@@ -6373,7 +6373,7 @@ static void print_binder_transaction_ilocked(struct seq_file *m,
 		seq_printf(m, " node %d", buffer->target_node->debug_id);
 	seq_printf(m, " size %zd:%zd offset %lx\n",
 		   buffer->data_size, buffer->offsets_size,
-		   proc->alloc.vm_start - buffer->user_data);
+		   buffer->user_data - proc->alloc.vm_start);
 }
 
 static void print_binder_work_ilocked(struct seq_file *m,