Skip to content

Commit e89d3a4

Browse files
committed
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
2 parents c5d714a + 1b9e740 commit e89d3a4

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

scripts/Makefile.extrawarn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
5151
KBUILD_CFLAGS += -Wno-format-zero-length
5252
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
5353
KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
54+
KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
5455
endif
5556

5657
endif

scripts/kconfig/confdata.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,10 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
979979

980980
fprintf(out, "\n$(deps_config): ;\n");
981981

982-
if (ferror(out)) /* error check for all fprintf() calls */
983-
return -1;
984-
982+
ret = ferror(out); /* error check for all fprintf() calls */
985983
fclose(out);
984+
if (ret)
985+
return -1;
986986

987987
if (rename(tmp, name)) {
988988
perror("rename");
@@ -994,14 +994,19 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
994994

995995
static int conf_touch_deps(void)
996996
{
997-
const char *name;
997+
const char *name, *tmp;
998998
struct symbol *sym;
999999
int res, i;
10001000

1001-
strcpy(depfile_path, "include/config/");
1002-
depfile_prefix_len = strlen(depfile_path);
1003-
10041001
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+
10051010
conf_read_simple(name, S_DEF_AUTO);
10061011
sym_calc_value(modules_sym);
10071012

@@ -1093,10 +1098,10 @@ static int __conf_write_autoconf(const char *filename,
10931098
print_symbol(file, sym);
10941099

10951100
/* check possible errors in conf_write_heading() and print_symbol() */
1096-
if (ferror(file))
1097-
return -1;
1098-
1101+
ret = ferror(file);
10991102
fclose(file);
1103+
if (ret)
1104+
return -1;
11001105

11011106
if (rename(tmp, filename)) {
11021107
perror("rename");

scripts/kconfig/preprocess.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static char *do_lineno(int argc, char *argv[])
141141
static char *do_shell(int argc, char *argv[])
142142
{
143143
FILE *p;
144-
char buf[256];
144+
char buf[4096];
145145
char *cmd;
146146
size_t nread;
147147
int i;

0 commit comments

Comments
 (0)