diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2022-04-24 21:07:46 +0200 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2022-05-07 20:16:59 +0200 |
commit | c155a47d83ab0b5ee96ebe1721057cba1936d0d5 (patch) | |
tree | 663b91dff82e2411306945ca145f68b8c732d846 /scripts/mod | |
parent | modpost: use snprintf() instead of sprintf() for safety (diff) | |
download | linux-c155a47d83ab0b5ee96ebe1721057cba1936d0d5.tar.xz linux-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 'scripts/mod')
-rw-r--r-- | scripts/mod/modpost.c | 3 |
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); |