Date: Wed, 21 May 2014 17:39:50 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266514 - head/usr.bin/mkimg Message-ID: <201405211739.s4LHdoG1021529@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Wed May 21 17:39:49 2014 New Revision: 266514 URL: http://svnweb.freebsd.org/changeset/base/266514 Log: Fix CID 1204379 (vtoc8.c) & CID 1204380 (bsd.c): Cast ncyls to lba_t before multiplying the 32-bit integrals to avoid any possibility of truncation before widening. Not a likely scenario to begin with... Modified: head/usr.bin/mkimg/bsd.c head/usr.bin/mkimg/vtoc8.c Modified: head/usr.bin/mkimg/bsd.c ============================================================================== --- head/usr.bin/mkimg/bsd.c Wed May 21 17:38:56 2014 (r266513) +++ head/usr.bin/mkimg/bsd.c Wed May 21 17:39:49 2014 (r266514) @@ -80,7 +80,7 @@ bsd_write(lba_t imgsz, void *bootcode) } else memset(buf, 0, BBSIZE); - imgsz = ncyls * nheads * nsecs; + imgsz = (lba_t)ncyls * nheads * nsecs; error = image_set_size(imgsz); if (error) { free(buf); Modified: head/usr.bin/mkimg/vtoc8.c ============================================================================== --- head/usr.bin/mkimg/vtoc8.c Wed May 21 17:38:56 2014 (r266513) +++ head/usr.bin/mkimg/vtoc8.c Wed May 21 17:39:49 2014 (r266514) @@ -71,7 +71,7 @@ vtoc8_write(lba_t imgsz, void *bootcode int error, n; uint16_t ofs, sum; - imgsz = ncyls * nheads * nsecs; + imgsz = (lba_t)ncyls * nheads * nsecs; memset(&vtoc8, 0, sizeof(vtoc8)); sprintf(vtoc8.ascii, "FreeBSD%lldM",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405211739.s4LHdoG1021529>