mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-03 18:20:25 +02:00 
			
		
		
		
	bpf: Drop reg_type_may_be_refcounted_or_null
It is not scalable to maintain a list of types that can have non-zero ref_obj_id. It is never set for scalars anyway, so just remove the conditional on register types and print it whenever it is non-zero. Acked-by: Dave Marchevsky <davemarchevsky@fb.com> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Acked-by: David Vernet <void@manifault.com> Link: https://lore.kernel.org/r/20221103191013.1236066-6-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
		
							parent
							
								
									f5e477a861
								
							
						
					
					
						commit
						a28ace782e
					
				
					 1 changed files with 1 additions and 8 deletions
				
			
		| 
						 | 
					@ -457,13 +457,6 @@ static bool reg_may_point_to_spin_lock(const struct bpf_reg_state *reg)
 | 
				
			||||||
		map_value_has_spin_lock(reg->map_ptr);
 | 
							map_value_has_spin_lock(reg->map_ptr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool reg_type_may_be_refcounted_or_null(enum bpf_reg_type type)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	type = base_type(type);
 | 
					 | 
				
			||||||
	return type == PTR_TO_SOCKET || type == PTR_TO_TCP_SOCK ||
 | 
					 | 
				
			||||||
		type == PTR_TO_MEM || type == PTR_TO_BTF_ID;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static bool type_is_rdonly_mem(u32 type)
 | 
					static bool type_is_rdonly_mem(u32 type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return type & MEM_RDONLY;
 | 
						return type & MEM_RDONLY;
 | 
				
			||||||
| 
						 | 
					@ -875,7 +868,7 @@ static void print_verifier_state(struct bpf_verifier_env *env,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (reg->id)
 | 
								if (reg->id)
 | 
				
			||||||
				verbose_a("id=%d", reg->id);
 | 
									verbose_a("id=%d", reg->id);
 | 
				
			||||||
			if (reg_type_may_be_refcounted_or_null(t) && reg->ref_obj_id)
 | 
								if (reg->ref_obj_id)
 | 
				
			||||||
				verbose_a("ref_obj_id=%d", reg->ref_obj_id);
 | 
									verbose_a("ref_obj_id=%d", reg->ref_obj_id);
 | 
				
			||||||
			if (t != SCALAR_VALUE)
 | 
								if (t != SCALAR_VALUE)
 | 
				
			||||||
				verbose_a("off=%d", reg->off);
 | 
									verbose_a("off=%d", reg->off);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue