The test in this loop: for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
was getting completely compiled out by my gcc, 7.0.0 20160520. The result was that the loop was going beyond the end of the builtin_fw array and giving me a page fault when trying to dereference b_fw->name inside strcmp(). I strongly suspect it's because __start_builtin_fw and __end_builtin_fw are both declared as (separate) arrays, and so gcc conludes that b_fw can never point to __end_builtin_fw. By changing these variables from arrays to pointers, gcc can no longer assume that these are separate arrays. Cc: sta...@vger.kernel.org Signed-off-by: Vegard Nossum <vegard.nos...@oracle.com> --- drivers/base/firmware_class.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 773fc30..4dddf7f 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -43,8 +43,8 @@ MODULE_LICENSE("GPL"); #ifdef CONFIG_FW_LOADER -extern struct builtin_fw __start_builtin_fw[]; -extern struct builtin_fw __end_builtin_fw[]; +extern struct builtin_fw *__start_builtin_fw; +extern struct builtin_fw *__end_builtin_fw; static bool fw_get_builtin_firmware(struct firmware *fw, const char *name) { -- 1.9.1