summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_linker.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-03-19 13:02:17 +0000
committerkib <kib@FreeBSD.org>2014-03-19 13:02:17 +0000
commit5484edfdac67206f6b345270ebbd62b56adaed47 (patch)
tree3598c42b0d1e1a9851b2dccd9b26c01aa1ecaee5 /sys/kern/kern_linker.c
parent7b315234adbe94851b4d37fed1ed2905649dca1d (diff)
downloadFreeBSD-src-5484edfdac67206f6b345270ebbd62b56adaed47.zip
FreeBSD-src-5484edfdac67206f6b345270ebbd62b56adaed47.tar.gz
MFC r263080:
Use correct types for sizeof() in the calculations for the malloc(9) sizes.
Diffstat (limited to 'sys/kern/kern_linker.c')
-rw-r--r--sys/kern/kern_linker.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index fa09b3f..632be63 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -725,14 +725,11 @@ linker_file_add_dependency(linker_file_t file, linker_file_t dep)
linker_file_t *newdeps;
sx_assert(&kld_sx, SA_XLOCKED);
- newdeps = malloc((file->ndeps + 1) * sizeof(linker_file_t *),
- M_LINKER, M_WAITOK | M_ZERO);
- if (newdeps == NULL)
- return (ENOMEM);
+ newdeps = malloc((file->ndeps + 1) * sizeof(*newdeps), M_LINKER,
+ M_WAITOK | M_ZERO);
if (file->deps) {
- bcopy(file->deps, newdeps,
- file->ndeps * sizeof(linker_file_t *));
+ bcopy(file->deps, newdeps, file->ndeps * sizeof(*newdeps));
free(file->deps, M_LINKER);
}
file->deps = newdeps;
OpenPOWER on IntegriCloud