Skip to contentSkip to conversation

bogus BUILD_BUG_ON() in bpa_iommu

PATCH New Al Viro 1 participant 1 message Sep 30, 2005

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 bogus BUILD_BUG_ON() in bpa_iommu

BUILD_BUG_ON(1) is asking for trouble (and getting it) when used
in that manner - dead code elimination happens after we parse it and invalid type is invalid type, dead code or not.
It might be version-dependent, but at least 4.0.1 refuses to
accept that.

----

arch/ppc64/kernel/bpa_iommu.c +5 -1
diff -urN RC14-rc2-git6-base/arch/ppc64/kernel/bpa_iommu.c current/arch/ppc64/kernel/bpa_iommu.c
@@ -99,7 +99,11 @@
 		break;
 
 	default: /* not a known compile time constant */
-		BUILD_BUG_ON(1);
+		{
+			/* BUILD_BUG_ON() is not usable here */
+			extern void __get_iost_entry_bad_page_size(void);
+			__get_iost_entry_bad_page_size();
+		}
 		break;
 	}