History

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

Andrzej Hajda committed 10 years ago

Commit 4af9ed51 parent d4c4fed1 file · +5 −2Browse files

Unified · Split

drivers/firmware/efi/efi.c+5−2
@@ -657,9 +657,12 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, · 656 unmodified lines
657657 }
658658
659659 if (subnode) {
660− node = of_get_flat_dt_subnode_by_name(node, subnode);
661− if (node < 0)
660+ int err = of_get_flat_dt_subnode_by_name(node, subnode);
661+
662+ if (err < 0)
662663 return 0;
664+
665+ node = err;
663666 }
664667
665668 return __find_uefi_params(node, info, dt_params[i].params);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t