From nobody Mon Sep 28 07:23:08 2026 Received: from out162-62-58-211.mail.qq.com (out162-62-58-211.mail.qq.com [162.62.58.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B47113EB818 for ; Tue, 25 Aug 2026 08:59:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.58.211 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787648349; cv=none; b=OH5ShO0BBeBo79N6wClO2gmNbq/TgcLZkAhRXZIxEZXuKJasCSp5qt1rCvT1SKVUJET56Sg04UlYcw3hgHJMabzy8A0iCuIyg5N3oOu0DA8fcwc1+dkdmTtV2Ph05xhpVuOz8lBQzNGPqFcd+QW12rzrwVn0Ilshu2Fw5BMjjM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787648349; c=relaxed/simple; bh=tV82BrJVvUJxd4iDCeKRKEf5OKhbbZrtQT6Z/vGdIvw=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=il95usZfu1fore43oI7leDI6rZhVN+nCxUrgnpu1aoQDHW7dvUK7k7wb77PhBJVu4TeIE0a3viFvjTgXtt4MsjD9i0bD8kHJxEfvkenyAss0NAhhQRoKC/G/83bUF69Fbqc7mgKoK48C5Ha7D6PBY2QoouEjyYbWOxEKO1YnWfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=wzBsaja8; arc=none smtp.client-ip=162.62.58.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="wzBsaja8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1787648342; bh=tV82BrJVvUJxd4iDCeKRKEf5OKhbbZrtQT6Z/vGdIvw=; h=Date:To:Cc:From:Subject; b=wzBsaja8xyy0NeHEJUvkxTkCH+oRnws1TK1cHudeYabtiiaCqi83j0gMXhEfYPBj/ Wyt9LGznrEgifFoCzhtOwnNYhk8TGLnwV+XHtBl51w/nustV7gD7upuUCgwE3zxTxJ nDN/ZKZ9Qrk4nvQQa06fh392oRtL13DelQuwE9XE= Received: from [192.168.255.10] ([111.206.145.19]) by newxmesmtplogicsvrszb51-1.qq.com (NewEsmtp) with SMTP id EC0932C1; Tue, 25 Aug 2026 16:59:00 +0800 X-QQ-mid: xmsmtpt1787648340t6dkge899 Message-ID: X-QQ-XMAILINFO: OCCQRJgnTnKdW/Hk1XQrixUfWir3H0SlVwjsMQMGdZ4r2ti9ey5Az59cfblsvL FgrswTP6JQi4avxyfhekdQ11gklk4TYjq3Bg+1NaCUficTka9glxGJP0Pf9lhNqIcUA/3lX3CzW/ kxmULZB2/Rw62Ax8LKmr+5hRYk3HutJS9iicBuofP4LFf9uJX5ZoaIaJHVnx4+jU1z/09x7ZZqaf 8oAnQE0tzzXAxjw+sjmEFOeKtTNn/XO6w1WlQWaevJ20Yu5a5BkkweHNqV7bmh4yOcM524+T51Jp UgW69c5ps2836lqh+fWel3tjUMaPyvdD1JFA9VvaJSL5YQZSg73o3n87MxxZyF2zQ5M/+9lg2A+U xT1Tg+Mrb3kDGBqbZ6CcVHlQFk9WWoHjQ8q6PTrxxYKHWWdIUCq1OX9C+zgZhxmymPy7QdYAShPu tKYrxDvDKcTJw+jPTEw/ihp9TBDFsnMIwmJyLUrtehL0yshc6wRd8O488dIoXSJR4o9BGDz02QPj aD+CsnLv4lS/XwLstqo2euMQqYm0No82cxwyNiWijcjgq4Bl3GkkEeVxgFyBOuJTcH6ytbRULRCx bQK7rSLtjzt2H0vLtElgKtGo+QaTilEIMuGC/RAugZ0vnhiaiwEVdTYeKypLdDYIyxx/x1eRIlIi TvgYAxg8+AGnlN7b902nsYhC487lMIK7M7AMDy0fGOJPYjd1am9RLiNsnZwKGfIdxpVM2VwoJY54 mjt7X82ly/+frjFjO4MAy0z8SHnLBRQnAjpPpnR0i/MLXZhpcT9OfV/T9vGjE1Fj8uqoLuxhT9kX nexgTuO0tfjzT7v/Dt+pi0966kFR9RNXNdHp3lsjQthnzNpYZGgZ+Pvy43yj6ewpzv/UK3Kiiru2 ajcop6PDcWI9PtVCAsT+pLd4AECxPNkW7JL/nfDDFyQzswDZRhSOuNko/2ifFlstlNSGA01YrZLf S6ZeW14qPAzpqyKUinqD4OZysyv69lGAo/ypsL3vf8bo1+cYhQysxFdmK5P3tajRAqMV2GIf6mI9 s5JPADmtZkSycrwjM/bXv6Xf1JgdMija7Q1iHHGV279He74ITPz3whot/kxojgaaH5RIJgRWnepT 6G/xO3dLeSL1QqI4g= X-QQ-XMRINFO: Mp0Kj//9VHAxzExpfF+O8yhSrljjwrznVg== X-OQ-MSGID: <7d290e03-0ea5-4c7a-995d-152f1d2bdfce@qq.com> Date: Tue, 25 Aug 2026 16:58:59 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: lgirdwood@gmail.com, broonie@kernel.org Cc: linux-kernel@vger.kernel.org From: Yang Zi <2959243019@qq.com> Subject: [PATCH] regulator: max8660: Fix NULL pointer dereference in probe Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable max8660_probe() dereferences pdata->num_subdevs without first checking that platform data is available. When the device is instantiated without a device tree node and without platform data, pdata remains NULL and probe crashes with a NULL pointer dereference. Add a check after the platform data is resolved and return -ENODEV when pdata is NULL. Signed-off-by: Yang Zi <2959243019@qq.com> --- =C2=A0drivers/regulator/max8660.c | 3 +++ =C2=A01 file changed, 3 insertions(+) diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index ede17099b727..ae606067df2d 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c @@ -396,6 +396,9 @@ static int max8660_probe(struct i2c_client *client) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0memset(of_node, 0, sizeof(of_node)); =C2=A0 =C2=A0 =C2=A0} =C2=A0 +=C2=A0 =C2=A0 if (!pdata) +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENODEV; + =C2=A0 =C2=A0 =C2=A0if (pdata->num_subdevs > MAX8660_V_END) { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_err(dev, "Too many regulators found!\= n"); =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -EINVAL;