From nobody Mon Jun 8 08:30:47 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 17DC239B94A; Thu, 4 Jun 2026 15:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780588347; cv=none; b=oGRbfKMiMqHBhvNAU8L8dtjlBJpmCiyZbOH+wLfkLt9LlBbVXwv9GCojgOpZtXv+ay3xsz5Q6D0BonkBW9mCr6z/t+JDDSDXxRt6FuyR0o2SHxXt1l8cHCCFMcw5wOBKpZrq8cS5X4i46y4n0g4yaRcaCIfjd2/yEfbh1Bmmm4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780588347; c=relaxed/simple; bh=JOcZLUmh7gbRly+h/cIGBQKluhSyTJ9xvbiALaYOA2c=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=iL9ovdk22V2yAj5yaNqNA3Ljoajsm5jSvbHsyMSzk3Up0NoVGgL42X1bH3lUiH0lvbioudFLMUejAfs9M06FX2gECOJN3kfSlWKhP7UgddarR4G2vHz8772klJLNJGPM5rw9jyPHP8h+r6WBfAYMM57UvpqmCeMFYSgTHU5zlDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=rwx3eGBr; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=5eCFEytl; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rwx3eGBr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5eCFEytl" Date: Thu, 04 Jun 2026 15:52:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780588339; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1H7VOczg/ZoBn3veSp2wBukgiP8qw5+kQU823FOCng=; b=rwx3eGBrgjCH2/h9JC849Fu6ixBHqEF25RUmI89iOJabVLfFvkwvO8W/ZLyjIljw1TDzLk z3s8Mct1O8cHBMxx/P6RRXZFhmm/hR4/1iT+hEJ0kzAc4eqhyu7fKbaMzQNclzAUa5bPLC MjbA7Q4AdyLc/WIbP/noPHtycofi5gx4BAP7ni6a8V0cXrrpp4GyjUZgvFcpiiKGGavmvb JBkwBp/nXR3iSoQhVexc3KbjOxl8dnUsgbnwPxV7UfOxlRT0GG4ogD2ZmML8avF2ZxcfGM fGPdYNUJg9tazKtkOZ/hiFGDmr36S3lmiRwupt0FEhjZ+i2MzevmGHix7NSbOA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780588339; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1H7VOczg/ZoBn3veSp2wBukgiP8qw5+kQU823FOCng=; b=5eCFEytlgqh/8IAer5zdPw9/Cio2kBGjxPdsKTJ3+trXuAQBBhaGi8wjK8pbiNrjqkL1m4 zAeODWtAY2qHD0Dw== From: "tip-bot2 for Li Jun" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cleanups] x86/pmem: Check for platform_device_alloc() retval Cc: Li Jun , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260602100711.2542568-1-lijun01@kylinos.cn> References: <20260602100711.2542568-1-lijun01@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178058833738.710.16759960723432690646.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/cleanups branch of tip: Commit-ID: 17b22e7a389e02e72912ab2904eac08da613c49e Gitweb: https://git.kernel.org/tip/17b22e7a389e02e72912ab2904eac08da= 613c49e Author: Li Jun AuthorDate: Tue, 02 Jun 2026 18:07:11 +08:00 Committer: Borislav Petkov (AMD) CommitterDate: Thu, 04 Jun 2026 08:31:56 -07:00 x86/pmem: Check for platform_device_alloc() retval Add proper error handling for the case when platform_device_alloc() returns NULL due to memory allocation failure. This prevents a potential NULL point= er dereference when trying to use the pdev pointer without checking if allocat= ion succeeded. [ bp: Massage commit message. ] Signed-off-by: Li Jun Signed-off-by: Borislav Petkov (AMD) Link: https://patch.msgid.link/20260602100711.2542568-1-lijun01@kylinos.cn --- arch/x86/kernel/pmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c index 23154d2..04fb221 100644 --- a/arch/x86/kernel/pmem.c +++ b/arch/x86/kernel/pmem.c @@ -27,6 +27,8 @@ static __init int register_e820_pmem(void) * simply here to trigger the module to load on demand. */ pdev =3D platform_device_alloc("e820_pmem", -1); + if (!pdev) + return -ENOMEM; =20 rc =3D platform_device_add(pdev); if (rc)