lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1648540212-9790-1-git-send-email-unSimple1993@163.com>
Date:   Tue, 29 Mar 2022 15:50:12 +0800
From:   QintaoShen <unSimple1993@....com>
To:     linus.walleij@...aro.org
Cc:     robh+dt@...nel.org, gregkh@...uxfoundation.org,
        yanaijie@...wei.com, linux-gpio@...r.kernel.org,
        devicetree@...r.kernel.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org, QintaoShen <unSimple1993@....com>
Subject: [PATCH v1] pinctrl: ralink: rt2880: Check for return value of devm_kcalloc()

The memory allocation function devm_kcalloc() may return NULL pointer,
so it is better to add a check for 'p->func[i]->pins' to avoid possible
NULL pointer dereference.

Signed-off-by: QintaoShen <unSimple1993@....com>
---
 drivers/pinctrl/ralink/pinctrl-rt2880.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pinctrl/ralink/pinctrl-rt2880.c b/drivers/pinctrl/ralink/pinctrl-rt2880.c
index 96fc06d..308610e 100644
--- a/drivers/pinctrl/ralink/pinctrl-rt2880.c
+++ b/drivers/pinctrl/ralink/pinctrl-rt2880.c
@@ -266,6 +266,10 @@ static int rt2880_pinmux_pins(struct rt2880_priv *p)
 						p->func[i]->pin_count,
 						sizeof(int),
 						GFP_KERNEL);
+        
+        if (!p->func[i]->pins)
+            continue;
+
 		for (j = 0; j < p->func[i]->pin_count; j++)
 			p->func[i]->pins[j] = p->func[i]->pin_first + j;
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ