Procházet zdrojové kódy

Make ELF constructors/destructors work

Since commit [4f8b339facb471192e021fffd5db545a0fbddbc3]
Simple EFI tools like for example t.c from the apps directory crash.

The reason seems to be a wrong null-pointer check in the
ctors()/dtors() functions in lib/entry.c.
sourceforge.net/u/davemueller

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Nigel Croxon před 1 rokem
rodič
revize
fe76d597a9
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4 4
      lib/entry.c

+ 4 - 4
lib/entry.c

@@ -24,13 +24,13 @@ static void ctors(void)
 {
 	for (funcp *location = (void *)&_init_array; location < (funcp *)&_init_array_end; location++) {
 		funcp func = *location;
-		if (location != NULL)
+		if (func != NULL)
 			func();
 	}
 
 	for (funcp *location = (void *)&__CTOR_LIST__; location < (funcp *)&__CTOR_END__; location++) {
 		funcp func = *location;
-		if (location != NULL)
+		if (func != NULL)
 			func();
 	}
 }
@@ -39,13 +39,13 @@ static void dtors(void)
 {
 	for (funcp *location = (void *)&__DTOR_LIST__; location < (funcp *)&__DTOR_END__; location++) {
 		funcp func = *location;
-		if (location != NULL)
+		if (func != NULL)
 			func();
 	}
 
 	for (funcp *location = (void *)&_fini_array; location < (funcp *)&_fini_array_end; location++) {
 		funcp func = *location;
-		if (location != NULL)
+		if (func != NULL)
 			func();
 	}
 }