From 6613eaa42b10731d91a4f18e2e679fb67cd22de4 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Mon, 13 Mar 2017 20:14:07 +0000 Subject: [PATCH] mkimg(1): let calloc(3) do the multiplication. Reviewed by: marcel MFC after: 1 week --- usr.bin/mkimg/qcow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/mkimg/qcow.c b/usr.bin/mkimg/qcow.c index a2fb86c62e2a..fdf2d8cbb141 100644 --- a/usr.bin/mkimg/qcow.c +++ b/usr.bin/mkimg/qcow.c @@ -216,7 +216,7 @@ qcow_write(int fd, u_int version) ofs = clstrsz * l2clno; nclstrs = 1 + clstr_l1tblsz + clstr_rctblsz; - l1tbl = calloc(1, clstrsz * clstr_l1tblsz); + l1tbl = calloc(clstr_l1tblsz, clstrsz); if (l1tbl == NULL) { error = ENOMEM; goto out; @@ -247,7 +247,7 @@ qcow_write(int fd, u_int version) } while (n < clstr_rcblks); if (rcclno > 0) { - rctbl = calloc(1, clstrsz * clstr_rctblsz); + rctbl = calloc(clstr_rctblsz, clstrsz); if (rctbl == NULL) { error = ENOMEM; goto out; @@ -297,7 +297,7 @@ qcow_write(int fd, u_int version) l1tbl = NULL; if (rcclno > 0) { - rcblk = calloc(1, clstrsz * clstr_rcblks); + rcblk = calloc(clstr_rcblks, clstrsz); if (rcblk == NULL) { error = ENOMEM; goto out;