summaryrefslogtreecommitdiff
path: root/scripts/mod/sumversion.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-08-12 21:48:51 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2024-09-01 20:34:48 +0900
commit4c2598e3b62102d5ea7f618e13d996b069cde27d (patch)
tree36bea1b2d3c9904f2a00ff194ea3e460cd771dc6 /scripts/mod/sumversion.c
parenta9d83d74783b00f9189c14180f77bbed133b092c (diff)
downloadlwn-4c2598e3b62102d5ea7f618e13d996b069cde27d.tar.gz
lwn-4c2598e3b62102d5ea7f618e13d996b069cde27d.zip
modpost: replace the use of NOFAIL() with xmalloc() etc.
I think x*alloc() functions are cleaner. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/mod/sumversion.c')
-rw-r--r--scripts/mod/sumversion.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index dc4878502276..e7d2da45b0df 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -8,6 +8,8 @@
#include <errno.h>
#include <string.h>
#include <limits.h>
+
+#include <xalloc.h>
#include "modpost.h"
/*
@@ -305,7 +307,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
const char *base;
int dirlen, ret = 0, check_files = 0;
- cmd = NOFAIL(malloc(strlen(objfile) + sizeof("..cmd")));
+ cmd = xmalloc(strlen(objfile) + sizeof("..cmd"));
base = strrchr(objfile, '/');
if (base) {
@@ -316,7 +318,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
dirlen = 0;
sprintf(cmd, ".%s.cmd", objfile);
}
- dir = NOFAIL(malloc(dirlen + 1));
+ dir = xmalloc(dirlen + 1);
strncpy(dir, objfile, dirlen);
dir[dirlen] = '\0';