[PATCH] depmod: always initialize "deps" in mod_get_all_sorted_dependencies()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixed Coverity CID #48861
---
 tools/depmod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/depmod.c b/tools/depmod.c
index e90ff83..bcefa09 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -1798,14 +1798,14 @@ static int mod_fill_all_unique_dependencies(const struct mod *mod, const struct
 
 static const struct mod **mod_get_all_sorted_dependencies(const struct mod *mod, size_t *n_deps)
 {
-	const struct mod **deps;
+	const struct mod **deps = NULL;
 	size_t last = 0;
 
 	*n_deps = mod_count_all_dependencies(mod);
 	if (*n_deps == 0)
 		return NULL;
 
-	deps = malloc(sizeof(struct mod *) * (*n_deps));
+	deps = calloc(1, sizeof(struct mod *) * (*n_deps));
 	if (deps == NULL)
 		return NULL;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux