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: <20240424063118.23200-1-jay.buddhabhatti@amd.com>
Date: Tue, 23 Apr 2024 23:31:18 -0700
From: Jay Buddhabhatti <jay.buddhabhatti@....com>
To: <michal.simek@....com>, <gregkh@...uxfoundation.org>
CC: <linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
	Jay Buddhabhatti <jay.buddhabhatti@....com>
Subject: [PATCH] drivers: soc: xilinx: check return status of get_api_version()

Check return status of pm_get_api_version and return error in case of failure to
avoid checking uninitialized pm_api_version variable from stack.

The issue is also reported by smatch on x86 as "warning: 'pm_api_version' is
used uninitialized".

Fixes: b9b3a8be28b3 ("firmware: xilinx: Remove eemi ops for get_api_version")
Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@....com>
---
 drivers/soc/xilinx/zynqmp_power.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c
index 965b1143936a..8570ab1a6857 100644
--- a/drivers/soc/xilinx/zynqmp_power.c
+++ b/drivers/soc/xilinx/zynqmp_power.c
@@ -3,6 +3,7 @@
  * Xilinx Zynq MPSoC Power Management
  *
  *  Copyright (C) 2014-2019 Xilinx, Inc.
+ *  Copyright (C) 2024, Advanced Micro Devices, Inc.
  *
  *  Davorin Mista <davorin.mista@...ios.com>
  *  Jolly Shah <jollys@...inx.com>
@@ -190,7 +191,9 @@ static int zynqmp_pm_probe(struct platform_device *pdev)
 	u32 pm_api_version;
 	struct mbox_client *client;
 
-	zynqmp_pm_get_api_version(&pm_api_version);
+	ret = zynqmp_pm_get_api_version(&pm_api_version);
+	if (ret)
+		return ret;
 
 	/* Check PM API version number */
 	if (pm_api_version < ZYNQMP_PM_VERSION)
-- 
2.17.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ