@@ -1265,9 +1265,9 @@ static int check_xadd(struct bpf_verifier_env *env, int insn_idx, struct bpf_ins
1265
1265
}
1266
1266
1267
1267
/* Does this register contain a constant zero? */
1268
- static bool register_is_null (struct bpf_reg_state reg )
1268
+ static bool register_is_null (struct bpf_reg_state * reg )
1269
1269
{
1270
- return reg . type == SCALAR_VALUE && tnum_equals_const (reg . var_off , 0 );
1270
+ return reg -> type == SCALAR_VALUE && tnum_equals_const (reg -> var_off , 0 );
1271
1271
}
1272
1272
1273
1273
/* when register 'regno' is passed into function that will read 'access_size'
@@ -1280,31 +1280,31 @@ static int check_stack_boundary(struct bpf_verifier_env *env, int regno,
1280
1280
int access_size , bool zero_size_allowed ,
1281
1281
struct bpf_call_arg_meta * meta )
1282
1282
{
1283
+ struct bpf_reg_state * reg = cur_regs (env ) + regno ;
1283
1284
struct bpf_verifier_state * state = env -> cur_state ;
1284
- struct bpf_reg_state * regs = state -> regs ;
1285
1285
int off , i , slot , spi ;
1286
1286
1287
- if (regs [ regno ]. type != PTR_TO_STACK ) {
1287
+ if (reg -> type != PTR_TO_STACK ) {
1288
1288
/* Allow zero-byte read from NULL, regardless of pointer type */
1289
1289
if (zero_size_allowed && access_size == 0 &&
1290
- register_is_null (regs [ regno ] ))
1290
+ register_is_null (reg ))
1291
1291
return 0 ;
1292
1292
1293
1293
verbose (env , "R%d type=%s expected=%s\n" , regno ,
1294
- reg_type_str [regs [ regno ]. type ],
1294
+ reg_type_str [reg -> type ],
1295
1295
reg_type_str [PTR_TO_STACK ]);
1296
1296
return - EACCES ;
1297
1297
}
1298
1298
1299
1299
/* Only allow fixed-offset stack reads */
1300
- if (!tnum_is_const (regs [ regno ]. var_off )) {
1300
+ if (!tnum_is_const (reg -> var_off )) {
1301
1301
char tn_buf [48 ];
1302
1302
1303
- tnum_strn (tn_buf , sizeof (tn_buf ), regs [ regno ]. var_off );
1303
+ tnum_strn (tn_buf , sizeof (tn_buf ), reg -> var_off );
1304
1304
verbose (env , "invalid variable stack read R%d var_off=%s\n" ,
1305
1305
regno , tn_buf );
1306
1306
}
1307
- off = regs [ regno ]. off + regs [ regno ]. var_off .value ;
1307
+ off = reg -> off + reg -> var_off .value ;
1308
1308
if (off >= 0 || off < - MAX_BPF_STACK || off + access_size > 0 ||
1309
1309
access_size < 0 || (access_size == 0 && !zero_size_allowed )) {
1310
1310
verbose (env , "invalid stack type R%d off=%d access_size=%d\n" ,
@@ -1412,7 +1412,7 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 regno,
1412
1412
* passed in as argument, it's a SCALAR_VALUE type. Final test
1413
1413
* happens during stack boundary checking.
1414
1414
*/
1415
- if (register_is_null (* reg ) &&
1415
+ if (register_is_null (reg ) &&
1416
1416
arg_type == ARG_PTR_TO_MEM_OR_NULL )
1417
1417
/* final test in check_stack_boundary() */ ;
1418
1418
else if (!type_is_pkt_pointer (type ) &&
0 commit comments