diff mbox series

[v3,6/6] apparmor: test: Use NULL macros

Message ID 20220207211144.1948690-6-ribalda@chromium.org
State Superseded
Headers show
Series None | expand

Commit Message

Ricardo Ribalda Feb. 7, 2022, 9:11 p.m. UTC
Replace the PTR_EQ NULL checks with the more idiomatic and specific NULL
macros.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 security/apparmor/policy_unpack_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Daniel Latypov Feb. 8, 2022, 12:18 a.m. UTC | #1
On Mon, Feb 7, 2022 at 1:11 PM Ricardo Ribalda <ribalda@chromium.org> wrote:
>
> Replace the PTR_EQ NULL checks with the more idiomatic and specific NULL
> macros.
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Acked-by: Daniel Latypov <dlatypov@google.com>

> ---
>  security/apparmor/policy_unpack_test.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/security/apparmor/policy_unpack_test.c b/security/apparmor/policy_unpack_test.c
> index 533137f45361..5c18d2f19862 100644
> --- a/security/apparmor/policy_unpack_test.c
> +++ b/security/apparmor/policy_unpack_test.c
> @@ -313,7 +313,7 @@ static void policy_unpack_test_unpack_strdup_out_of_bounds(struct kunit *test)
>         size = unpack_strdup(puf->e, &string, TEST_STRING_NAME);
>
>         KUNIT_EXPECT_EQ(test, size, 0);
> -       KUNIT_EXPECT_PTR_EQ(test, string, (char *)NULL);
> +       KUNIT_EXPECT_NULL(test, string);
>         KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start);
>  }
>
> @@ -409,7 +409,7 @@ static void policy_unpack_test_unpack_u16_chunk_out_of_bounds_1(
>         size = unpack_u16_chunk(puf->e, &chunk);
>
>         KUNIT_EXPECT_EQ(test, size, (size_t)0);
> -       KUNIT_EXPECT_PTR_EQ(test, chunk, (char *)NULL);
> +       KUNIT_EXPECT_NULL(test, chunk);
>         KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, puf->e->end - 1);
>  }
>
> @@ -431,7 +431,7 @@ static void policy_unpack_test_unpack_u16_chunk_out_of_bounds_2(
>         size = unpack_u16_chunk(puf->e, &chunk);
>
>         KUNIT_EXPECT_EQ(test, size, (size_t)0);
> -       KUNIT_EXPECT_PTR_EQ(test, chunk, (char *)NULL);
> +       KUNIT_EXPECT_NULL(test, chunk);
>         KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, puf->e->start + TEST_U16_OFFSET);
>  }
>
> --
> 2.35.0.263.gb82422642f-goog
>
diff mbox series

Patch

diff --git a/security/apparmor/policy_unpack_test.c b/security/apparmor/policy_unpack_test.c
index 533137f45361..5c18d2f19862 100644
--- a/security/apparmor/policy_unpack_test.c
+++ b/security/apparmor/policy_unpack_test.c
@@ -313,7 +313,7 @@  static void policy_unpack_test_unpack_strdup_out_of_bounds(struct kunit *test)
 	size = unpack_strdup(puf->e, &string, TEST_STRING_NAME);
 
 	KUNIT_EXPECT_EQ(test, size, 0);
-	KUNIT_EXPECT_PTR_EQ(test, string, (char *)NULL);
+	KUNIT_EXPECT_NULL(test, string);
 	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start);
 }
 
@@ -409,7 +409,7 @@  static void policy_unpack_test_unpack_u16_chunk_out_of_bounds_1(
 	size = unpack_u16_chunk(puf->e, &chunk);
 
 	KUNIT_EXPECT_EQ(test, size, (size_t)0);
-	KUNIT_EXPECT_PTR_EQ(test, chunk, (char *)NULL);
+	KUNIT_EXPECT_NULL(test, chunk);
 	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, puf->e->end - 1);
 }
 
@@ -431,7 +431,7 @@  static void policy_unpack_test_unpack_u16_chunk_out_of_bounds_2(
 	size = unpack_u16_chunk(puf->e, &chunk);
 
 	KUNIT_EXPECT_EQ(test, size, (size_t)0);
-	KUNIT_EXPECT_PTR_EQ(test, chunk, (char *)NULL);
+	KUNIT_EXPECT_NULL(test, chunk);
 	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, puf->e->start + TEST_U16_OFFSET);
 }