svn commit: r315212 - head/usr.bin/mkimg

Pedro F. Giffuni pfg at FreeBSD.org
Mon Mar 13 20:14:09 UTC 2017


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;


More information about the svn-src-all mailing list