]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
kbuild: modpost: include .*.cmd files only when targets exist
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 30 Jul 2019 15:58:59 +0000 (00:58 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Aug 2019 17:08:14 +0000 (19:08 +0200)
commit 944cfe9be1fbbec73bab2f7e77fe2e8f9c72970f upstream.

If a build rule fails, the .DELETE_ON_ERROR special target removes the
target, but does nothing for the .*.cmd file, which might be corrupted.
So, .*.cmd files should be included only when the corresponding targets
exist.

Commit 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd
files") missed to fix up this file.

Fixes: 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd")
Cc: <stable@vger.kernel.org> # v5.0+
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
scripts/Makefile.modpost

index fec6ec2ffa47dcc3d3b82c82921434bee087dfd6..38d77353c66ab426742368a3c4bc5235b0d6c0d1 100644 (file)
@@ -142,10 +142,8 @@ FORCE:
 # optimization, we don't need to read them if the target does not
 # exist, we will rebuild anyway in that case.
 
-cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
+existing-targets := $(wildcard $(sort $(targets)))
 
-ifneq ($(cmd_files),)
-  include $(cmd_files)
-endif
+-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
 
 .PHONY: $(PHONY)