Merge tag 'kbuild-fixes-v5.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

- Fix the truncated path issue for HAVE_GCC_PLUGINS test in Kconfig

- Move -Wunsligned-access to W=1 builds to avoid sprinkling warnings
for the latest Clang

- Fix missing fclose() in Kconfig

- Fix Kconfig to touch dep headers correctly when KCONFIG_AUTOCONFIG is
overridden.

* tag 'kbuild-fixes-v5.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
kconfig: fix failing to generate auto.conf
kconfig: fix missing fclose() on error paths
Makefile.extrawarn: Move -Wunaligned-access to W=1
kconfig: let 'shell' return enough output for deep path names

Changed files
+17 -11
scripts
+1
scripts/Makefile.extrawarn
··· 51 51 KBUILD_CFLAGS += -Wno-format-zero-length 52 52 KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) 53 53 KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare 54 + KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) 54 55 endif 55 56 56 57 endif
+15 -10
scripts/kconfig/confdata.c
··· 979 979 980 980 fprintf(out, "\n$(deps_config): ;\n"); 981 981 982 - if (ferror(out)) /* error check for all fprintf() calls */ 983 - return -1; 984 - 982 + ret = ferror(out); /* error check for all fprintf() calls */ 985 983 fclose(out); 984 + if (ret) 985 + return -1; 986 986 987 987 if (rename(tmp, name)) { 988 988 perror("rename"); ··· 994 994 995 995 static int conf_touch_deps(void) 996 996 { 997 - const char *name; 997 + const char *name, *tmp; 998 998 struct symbol *sym; 999 999 int res, i; 1000 1000 1001 - strcpy(depfile_path, "include/config/"); 1002 - depfile_prefix_len = strlen(depfile_path); 1003 - 1004 1001 name = conf_get_autoconfig_name(); 1002 + tmp = strrchr(name, '/'); 1003 + depfile_prefix_len = tmp ? tmp - name + 1 : 0; 1004 + if (depfile_prefix_len + 1 > sizeof(depfile_path)) 1005 + return -1; 1006 + 1007 + strncpy(depfile_path, name, depfile_prefix_len); 1008 + depfile_path[depfile_prefix_len] = 0; 1009 + 1005 1010 conf_read_simple(name, S_DEF_AUTO); 1006 1011 sym_calc_value(modules_sym); 1007 1012 ··· 1098 1093 print_symbol(file, sym); 1099 1094 1100 1095 /* check possible errors in conf_write_heading() and print_symbol() */ 1101 - if (ferror(file)) 1102 - return -1; 1103 - 1096 + ret = ferror(file); 1104 1097 fclose(file); 1098 + if (ret) 1099 + return -1; 1105 1100 1106 1101 if (rename(tmp, filename)) { 1107 1102 perror("rename");
+1 -1
scripts/kconfig/preprocess.c
··· 141 141 static char *do_shell(int argc, char *argv[]) 142 142 { 143 143 FILE *p; 144 - char buf[256]; 144 + char buf[4096]; 145 145 char *cmd; 146 146 size_t nread; 147 147 int i;