aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-04-25 04:07:46 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2022-05-08 03:16:59 +0900
commitc155a47d83ab0b5ee96ebe1721057cba1936d0d5 (patch)
tree663b91dff82e2411306945ca145f68b8c732d846 /scripts/mod/modpost.c
parentmodpost: use snprintf() instead of sprintf() for safety (diff)
downloadlinux-dev-c155a47d83ab0b5ee96ebe1721057cba1936d0d5.tar.xz
linux-dev-c155a47d83ab0b5ee96ebe1721057cba1936d0d5.zip
modpost: do not write out any file when error occurred
If an error occurs, modpost will fail anyway. Do not write out any content (, which might be invalid). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to '')
-rw-r--r--scripts/mod/modpost.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 141370ebbfd3..f0d48f65fb33 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2333,6 +2333,9 @@ static void write_buf(struct buffer *b, const char *fname)
{
FILE *file;
+ if (error_occurred)
+ return;
+
file = fopen(fname, "w");
if (!file) {
perror(fname);