Skip to content

Commit

Permalink
Merge tag 'kbuild-fixes-v5.17-2' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/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
  • Loading branch information
Linus Torvalds committed Feb 13, 2022
2 parents c5d714a + 1b9e740 commit e89d3a4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions scripts/Makefile.extrawarn
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
KBUILD_CFLAGS += -Wno-format-zero-length
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
endif

endif
Expand Down
25 changes: 15 additions & 10 deletions scripts/kconfig/confdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,10 +979,10 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)

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

if (ferror(out)) /* error check for all fprintf() calls */
return -1;

ret = ferror(out); /* error check for all fprintf() calls */
fclose(out);
if (ret)
return -1;

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

static int conf_touch_deps(void)
{
const char *name;
const char *name, *tmp;
struct symbol *sym;
int res, i;

strcpy(depfile_path, "include/config/");
depfile_prefix_len = strlen(depfile_path);

name = conf_get_autoconfig_name();
tmp = strrchr(name, '/');
depfile_prefix_len = tmp ? tmp - name + 1 : 0;
if (depfile_prefix_len + 1 > sizeof(depfile_path))
return -1;

strncpy(depfile_path, name, depfile_prefix_len);
depfile_path[depfile_prefix_len] = 0;

conf_read_simple(name, S_DEF_AUTO);
sym_calc_value(modules_sym);

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

/* check possible errors in conf_write_heading() and print_symbol() */
if (ferror(file))
return -1;

ret = ferror(file);
fclose(file);
if (ret)
return -1;

if (rename(tmp, filename)) {
perror("rename");
Expand Down
2 changes: 1 addition & 1 deletion scripts/kconfig/preprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static char *do_lineno(int argc, char *argv[])
static char *do_shell(int argc, char *argv[])
{
FILE *p;
char buf[256];
char buf[4096];
char *cmd;
size_t nread;
int i;
Expand Down

0 comments on commit e89d3a4

Please sign in to comment.