• Home
  • Raw
  • Download

Lines Matching refs:e

47 	struct aa_ext *e;  member
55 struct aa_ext *e; in build_aa_ext_struct() local
60 e = kunit_kmalloc(test, sizeof(*e), GFP_USER); in build_aa_ext_struct()
61 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, e); in build_aa_ext_struct()
63 e->start = buf; in build_aa_ext_struct()
64 e->end = e->start + buf_size; in build_aa_ext_struct()
65 e->pos = e->start; in build_aa_ext_struct()
71 buf = e->start + TEST_STRING_BUF_OFFSET; in build_aa_ext_struct()
76 buf = e->start + TEST_NAMED_U32_BUF_OFFSET; in build_aa_ext_struct()
83 buf = e->start + TEST_NAMED_U64_BUF_OFFSET; in build_aa_ext_struct()
90 buf = e->start + TEST_NAMED_BLOB_BUF_OFFSET; in build_aa_ext_struct()
99 buf = e->start + TEST_NAMED_ARRAY_BUF_OFFSET; in build_aa_ext_struct()
106 return e; in build_aa_ext_struct()
118 puf->e = build_aa_ext_struct(puf, test, e_size); in policy_unpack_test_init()
128 KUNIT_EXPECT_TRUE(test, inbounds(puf->e, 0)); in policy_unpack_test_inbounds_when_inbounds()
129 KUNIT_EXPECT_TRUE(test, inbounds(puf->e, puf->e_size / 2)); in policy_unpack_test_inbounds_when_inbounds()
130 KUNIT_EXPECT_TRUE(test, inbounds(puf->e, puf->e_size)); in policy_unpack_test_inbounds_when_inbounds()
137 KUNIT_EXPECT_FALSE(test, inbounds(puf->e, puf->e_size + 1)); in policy_unpack_test_inbounds_when_out_of_bounds()
145 puf->e->pos += TEST_ARRAY_BUF_OFFSET; in policy_unpack_test_unpack_array_with_null_name()
147 array_size = unpack_array(puf->e, NULL); in policy_unpack_test_unpack_array_with_null_name()
150 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_array_with_null_name()
151 puf->e->start + TEST_ARRAY_BUF_OFFSET + sizeof(u16) + 1); in policy_unpack_test_unpack_array_with_null_name()
160 puf->e->pos += TEST_NAMED_ARRAY_BUF_OFFSET; in policy_unpack_test_unpack_array_with_name()
162 array_size = unpack_array(puf->e, name); in policy_unpack_test_unpack_array_with_name()
165 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_array_with_name()
166 puf->e->start + TEST_ARRAY_BUF_OFFSET + sizeof(u16) + 1); in policy_unpack_test_unpack_array_with_name()
175 puf->e->pos += TEST_NAMED_ARRAY_BUF_OFFSET; in policy_unpack_test_unpack_array_out_of_bounds()
176 puf->e->end = puf->e->start + TEST_ARRAY_BUF_OFFSET + sizeof(u16); in policy_unpack_test_unpack_array_out_of_bounds()
178 array_size = unpack_array(puf->e, name); in policy_unpack_test_unpack_array_out_of_bounds()
181 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_array_out_of_bounds()
182 puf->e->start + TEST_NAMED_ARRAY_BUF_OFFSET); in policy_unpack_test_unpack_array_out_of_bounds()
191 puf->e->pos += TEST_BLOB_BUF_OFFSET; in policy_unpack_test_unpack_blob_with_null_name()
192 size = unpack_blob(puf->e, &blob, NULL); in policy_unpack_test_unpack_blob_with_null_name()
205 puf->e->pos += TEST_NAMED_BLOB_BUF_OFFSET; in policy_unpack_test_unpack_blob_with_name()
206 size = unpack_blob(puf->e, &blob, TEST_BLOB_NAME); in policy_unpack_test_unpack_blob_with_name()
220 puf->e->pos += TEST_NAMED_BLOB_BUF_OFFSET; in policy_unpack_test_unpack_blob_out_of_bounds()
221 start = puf->e->pos; in policy_unpack_test_unpack_blob_out_of_bounds()
222 puf->e->end = puf->e->start + TEST_BLOB_BUF_OFFSET in policy_unpack_test_unpack_blob_out_of_bounds()
225 size = unpack_blob(puf->e, &blob, TEST_BLOB_NAME); in policy_unpack_test_unpack_blob_out_of_bounds()
228 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start); in policy_unpack_test_unpack_blob_out_of_bounds()
237 puf->e->pos += TEST_STRING_BUF_OFFSET; in policy_unpack_test_unpack_str_with_null_name()
238 size = unpack_str(puf->e, &string, NULL); in policy_unpack_test_unpack_str_with_null_name()
250 size = unpack_str(puf->e, &string, TEST_STRING_NAME); in policy_unpack_test_unpack_str_with_name()
260 void *start = puf->e->pos; in policy_unpack_test_unpack_str_out_of_bounds()
263 puf->e->end = puf->e->pos + TEST_STRING_BUF_OFFSET in policy_unpack_test_unpack_str_out_of_bounds()
266 size = unpack_str(puf->e, &string, TEST_STRING_NAME); in policy_unpack_test_unpack_str_out_of_bounds()
269 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start); in policy_unpack_test_unpack_str_out_of_bounds()
278 puf->e->pos += TEST_STRING_BUF_OFFSET; in policy_unpack_test_unpack_strdup_with_null_name()
279 size = unpack_strdup(puf->e, &string, NULL); in policy_unpack_test_unpack_strdup_with_null_name()
283 ((uintptr_t)puf->e->start <= (uintptr_t)string) in policy_unpack_test_unpack_strdup_with_null_name()
284 && ((uintptr_t)string <= (uintptr_t)puf->e->end)); in policy_unpack_test_unpack_strdup_with_null_name()
294 size = unpack_strdup(puf->e, &string, TEST_STRING_NAME); in policy_unpack_test_unpack_strdup_with_name()
298 ((uintptr_t)puf->e->start <= (uintptr_t)string) in policy_unpack_test_unpack_strdup_with_name()
299 && ((uintptr_t)string <= (uintptr_t)puf->e->end)); in policy_unpack_test_unpack_strdup_with_name()
306 void *start = puf->e->pos; in policy_unpack_test_unpack_strdup_out_of_bounds()
310 puf->e->end = puf->e->pos + TEST_STRING_BUF_OFFSET in policy_unpack_test_unpack_strdup_out_of_bounds()
313 size = unpack_strdup(puf->e, &string, TEST_STRING_NAME); in policy_unpack_test_unpack_strdup_out_of_bounds()
317 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start); in policy_unpack_test_unpack_strdup_out_of_bounds()
325 puf->e->pos += TEST_U32_BUF_OFFSET; in policy_unpack_test_unpack_nameX_with_null_name()
327 success = unpack_nameX(puf->e, AA_U32, NULL); in policy_unpack_test_unpack_nameX_with_null_name()
330 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_nameX_with_null_name()
331 puf->e->start + TEST_U32_BUF_OFFSET + 1); in policy_unpack_test_unpack_nameX_with_null_name()
339 puf->e->pos += TEST_U32_BUF_OFFSET; in policy_unpack_test_unpack_nameX_with_wrong_code()
341 success = unpack_nameX(puf->e, AA_BLOB, NULL); in policy_unpack_test_unpack_nameX_with_wrong_code()
344 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_nameX_with_wrong_code()
345 puf->e->start + TEST_U32_BUF_OFFSET); in policy_unpack_test_unpack_nameX_with_wrong_code()
354 puf->e->pos += TEST_NAMED_U32_BUF_OFFSET; in policy_unpack_test_unpack_nameX_with_name()
356 success = unpack_nameX(puf->e, AA_U32, name); in policy_unpack_test_unpack_nameX_with_name()
359 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_nameX_with_name()
360 puf->e->start + TEST_U32_BUF_OFFSET + 1); in policy_unpack_test_unpack_nameX_with_name()
369 puf->e->pos += TEST_NAMED_U32_BUF_OFFSET; in policy_unpack_test_unpack_nameX_with_wrong_name()
371 success = unpack_nameX(puf->e, AA_U32, name); in policy_unpack_test_unpack_nameX_with_wrong_name()
374 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_nameX_with_wrong_name()
375 puf->e->start + TEST_NAMED_U32_BUF_OFFSET); in policy_unpack_test_unpack_nameX_with_wrong_name()
384 puf->e->pos += TEST_U16_OFFSET; in policy_unpack_test_unpack_u16_chunk_basic()
390 puf->e->end += TEST_U16_DATA; in policy_unpack_test_unpack_u16_chunk_basic()
392 size = unpack_u16_chunk(puf->e, &chunk); in policy_unpack_test_unpack_u16_chunk_basic()
395 puf->e->start + TEST_U16_OFFSET + 2); in policy_unpack_test_unpack_u16_chunk_basic()
397 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, (void *)(chunk + TEST_U16_DATA)); in policy_unpack_test_unpack_u16_chunk_basic()
407 puf->e->pos = puf->e->end - 1; in policy_unpack_test_unpack_u16_chunk_out_of_bounds_1()
409 size = unpack_u16_chunk(puf->e, &chunk); in policy_unpack_test_unpack_u16_chunk_out_of_bounds_1()
413 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, puf->e->end - 1); in policy_unpack_test_unpack_u16_chunk_out_of_bounds_1()
423 puf->e->pos += TEST_U16_OFFSET; in policy_unpack_test_unpack_u16_chunk_out_of_bounds_2()
429 puf->e->end = puf->e->pos + TEST_U16_DATA - 1; in policy_unpack_test_unpack_u16_chunk_out_of_bounds_2()
431 size = unpack_u16_chunk(puf->e, &chunk); in policy_unpack_test_unpack_u16_chunk_out_of_bounds_2()
435 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, puf->e->start + TEST_U16_OFFSET); in policy_unpack_test_unpack_u16_chunk_out_of_bounds_2()
444 puf->e->pos += TEST_U32_BUF_OFFSET; in policy_unpack_test_unpack_u32_with_null_name()
446 success = unpack_u32(puf->e, &data, NULL); in policy_unpack_test_unpack_u32_with_null_name()
450 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_u32_with_null_name()
451 puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1); in policy_unpack_test_unpack_u32_with_null_name()
461 puf->e->pos += TEST_NAMED_U32_BUF_OFFSET; in policy_unpack_test_unpack_u32_with_name()
463 success = unpack_u32(puf->e, &data, name); in policy_unpack_test_unpack_u32_with_name()
467 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_u32_with_name()
468 puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1); in policy_unpack_test_unpack_u32_with_name()
478 puf->e->pos += TEST_NAMED_U32_BUF_OFFSET; in policy_unpack_test_unpack_u32_out_of_bounds()
479 puf->e->end = puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32); in policy_unpack_test_unpack_u32_out_of_bounds()
481 success = unpack_u32(puf->e, &data, name); in policy_unpack_test_unpack_u32_out_of_bounds()
484 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_u32_out_of_bounds()
485 puf->e->start + TEST_NAMED_U32_BUF_OFFSET); in policy_unpack_test_unpack_u32_out_of_bounds()
494 puf->e->pos += TEST_U64_BUF_OFFSET; in policy_unpack_test_unpack_u64_with_null_name()
496 success = unpack_u64(puf->e, &data, NULL); in policy_unpack_test_unpack_u64_with_null_name()
500 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_u64_with_null_name()
501 puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1); in policy_unpack_test_unpack_u64_with_null_name()
511 puf->e->pos += TEST_NAMED_U64_BUF_OFFSET; in policy_unpack_test_unpack_u64_with_name()
513 success = unpack_u64(puf->e, &data, name); in policy_unpack_test_unpack_u64_with_name()
517 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_u64_with_name()
518 puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1); in policy_unpack_test_unpack_u64_with_name()
528 puf->e->pos += TEST_NAMED_U64_BUF_OFFSET; in policy_unpack_test_unpack_u64_out_of_bounds()
529 puf->e->end = puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64); in policy_unpack_test_unpack_u64_out_of_bounds()
531 success = unpack_u64(puf->e, &data, name); in policy_unpack_test_unpack_u64_out_of_bounds()
534 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, in policy_unpack_test_unpack_u64_out_of_bounds()
535 puf->e->start + TEST_NAMED_U64_BUF_OFFSET); in policy_unpack_test_unpack_u64_out_of_bounds()
541 bool success = unpack_X(puf->e, AA_NAME); in policy_unpack_test_unpack_X_code_match()
544 KUNIT_EXPECT_TRUE(test, puf->e->pos == puf->e->start + 1); in policy_unpack_test_unpack_X_code_match()
550 bool success = unpack_X(puf->e, AA_STRING); in policy_unpack_test_unpack_X_code_mismatch()
553 KUNIT_EXPECT_TRUE(test, puf->e->pos == puf->e->start); in policy_unpack_test_unpack_X_code_mismatch()
561 puf->e->pos = puf->e->end; in policy_unpack_test_unpack_X_out_of_bounds()
562 success = unpack_X(puf->e, AA_NAME); in policy_unpack_test_unpack_X_out_of_bounds()