Date: Mon, 13 Mar 2017 20:14:07 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315212 - head/usr.bin/mkimg Message-ID: <201703132014.v2DKE76m029776@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Mon Mar 13 20:14:07 2017 New Revision: 315212 URL: https://svnweb.freebsd.org/changeset/base/315212 Log: mkimg(1): let calloc(3) do the multiplication. Reviewed by: marcel MFC after: 1 week Modified: head/usr.bin/mkimg/qcow.c Modified: head/usr.bin/mkimg/qcow.c ============================================================================== --- head/usr.bin/mkimg/qcow.c Mon Mar 13 19:54:20 2017 (r315211) +++ head/usr.bin/mkimg/qcow.c Mon Mar 13 20:14:07 2017 (r315212) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703132014.v2DKE76m029776>