Skip to contentSkip to conversation

FAILED: patch "[PATCH] efi: Fix handling error value in fdt_find_uefi_params" failed to apply to 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 22, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.7-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 4af9ed578a50cd331a725322cfd9d555251ce788 Mon Sep 17 00:00:00 2001

From: Andrzej Hajda <[email protected]>
Date: Tue, 30 Aug 2016 12:41:37 +0200
Subject: [PATCH] efi: Fix handling error value in fdt_find_uefi_params

of_get_flat_dt_subnode_by_name can return negative value in case of error. Assigning the result to unsigned variable and checking if the variable is lesser than zero is incorrect and always false.
The patch fixes it by using signed variable to check the result.

The problem has been detected using semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci

Cc Bartlomiej Zolnierkiewicz <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Shawn Lin <[email protected]>
Cc Mark Rutland <[email protected]>
drivers/firmware/efi/efi.c +5 -2
index 5a2631af7410..7dd2e2d37231 100644
@@ -657,9 +657,12 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname,
 		}
 
 		if (subnode) {
-			node = of_get_flat_dt_subnode_by_name(node, subnode);
-			if (node < 0)
+			int err = of_get_flat_dt_subnode_by_name(node, subnode);
+
+			if (err < 0)
 				return 0;
+
+			node = err;
 		}
 
 		return __find_uefi_params(node, info, dt_params[i].params);