[PATCH 04/11] match_metadata_desc1(): Use calloc instead of malloc+memset

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


From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
---
 super1.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/super1.c b/super1.c
index 1f0c8bc..ca9e4e4 100644
--- a/super1.c
+++ b/super1.c
@@ -1401,10 +1401,10 @@ static int load_super1(struct supertype *st, int fd, char *devname)
 
 static struct supertype *match_metadata_desc1(char *arg)
 {
-	struct supertype *st = malloc(sizeof(*st));
-	if (!st) return st;
+	struct supertype *st = calloc(1, sizeof(*st));
+	if (!st)
+		return st;
 
-	memset(st, 0, sizeof(*st));
 	st->container_dev = NoMdDev;
 	st->ss = &super1;
 	st->max_devs = 384;
-- 
1.7.7.6

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


[ATA RAID]     [Linux SCSI Target Infrastructure]     [Managing RAID on Linux]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device-Mapper]     [Kernel]     [Linux Books]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Photos]     [Yosemite Photos]     [Yosemite News]     [AMD 64]     [Linux Networking]

Add to Google Powered by Linux