From: Dan Carpenter Date: Wed, 2 Dec 2020 14:44:07 +0000 (+0300) Subject: x86/platform/uv: Fix an error code in uv_hubs_init() X-Git-Tag: v5.11-rc1~193^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18d047bd89b8c1f9ba3c9b2d2f7309c953b3ce97;p=thirdparty%2Fkernel%2Flinux.git x86/platform/uv: Fix an error code in uv_hubs_init() Return -ENOMEM on allocation failure instead of returning random stack memory contents. Fixes: 4fc2cf1f2daf ("x86/platform/uv: Add new uv_sysfs platform driver") Signed-off-by: Dan Carpenter Signed-off-by: Borislav Petkov Reviewed-by: Justin Ernst Link: https://lkml.kernel.org/r/X8eoN/jMAJb3H3iv@mwanda --- diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c index 54c342579f1ca..e17ce8c4cdada 100644 --- a/drivers/platform/x86/uv_sysfs.c +++ b/drivers/platform/x86/uv_sysfs.c @@ -248,6 +248,7 @@ static int uv_hubs_init(void) uv_hubs[i] = kzalloc(sizeof(*uv_hubs[i]), GFP_KERNEL); if (!uv_hubs[i]) { i--; + ret = -ENOMEM; goto err_hubs; }