[PATCH 07/11] btrfs-progs: use calloc instead of malloc+memset for mkfs.c

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

 



This patch is generated from a coccinelle semantic patch:

	identifier t;
	expression e;
	statement s;
	@@
	-t = malloc(e);
	+t = calloc(1, e);
	(
	if (!t) s
	|
	if (t == NULL) s
	|
	)
	-memset(t, 0, e);

Signed-off-by: Silvio Fricke <silvio.fricke@xxxxxxxxx>
---
 mkfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mkfs.c b/mkfs.c
index a5802f7..ecd6fbf 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -668,12 +668,11 @@ static int add_file_items(struct btrfs_trans_handle *trans,
 	 * do our IO in extent buffers so it can work
 	 * against any raid type
 	 */
-	eb = malloc(sizeof(*eb) + sectorsize);
+	eb = calloc(1, sizeof(*eb) + sectorsize);
 	if (!eb) {
 		ret = -ENOMEM;
 		goto end;
 	}
-	memset(eb, 0, sizeof(*eb) + sectorsize);
 
 again:
 
-- 
2.5.3

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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux