]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
pinctrl: qcom: tlmm-test: Fix potential null dereference in tlmm kunit test
authorCharles Han <hanchunchao@inspur.com>
Tue, 25 Mar 2025 09:49:32 +0000 (17:49 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 15 Apr 2025 07:23:07 +0000 (09:23 +0200)
kunit_kzalloc() may return a NULL pointer, dereferencing it without
NULL check may lead to NULL dereference.
Add a NULL check for grp.

Fixes: c7984dc0a2b9 ("pinctrl: qcom: Add test case for TLMM interrupt handling")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://lore.kernel.org/20250325094932.4733-1-hanchunchao@inspur.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/qcom/tlmm-test.c

index fd02bf3a76cbccd290735f77f19dfb26730be679..7b99e89e0f6703f7c06080dbd76c1c9d9005f4c8 100644 (file)
@@ -547,6 +547,7 @@ static int tlmm_test_init(struct kunit *test)
        struct tlmm_test_priv *priv;
 
        priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
+       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv);
 
        atomic_set(&priv->intr_count, 0);
        atomic_set(&priv->thread_count, 0);