svn commit: r319337 - head/sbin/camcontrol
Alan Somers
asomers at FreeBSD.org
Wed May 31 14:59:05 UTC 2017
Author: asomers
Date: Wed May 31 14:59:03 2017
New Revision: 319337
URL: https://svnweb.freebsd.org/changeset/base/319337
Log:
Fix integer overflow in "camcontrol format"
Reported by: Coverity
CID: 1011426
MFC after: 1 week
Sponsored by: Spectra Logic Corp
Modified:
head/sbin/camcontrol/camcontrol.c
Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c Wed May 31 14:53:50 2017 (r319336)
+++ head/sbin/camcontrol/camcontrol.c Wed May 31 14:59:03 2017 (r319337)
@@ -6221,15 +6221,15 @@ doreport:
if ((scsi_get_sks(sense, ccb->csio.sense_len -
ccb->csio.sense_resid, sks) == 0)
&& (quiet == 0)) {
- int val;
+ uint32_t val;
u_int64_t percentage;
val = scsi_2btoul(&sks[1]);
- percentage = 10000 * val;
+ percentage = 10000ull * val;
fprintf(stdout,
"\rFormatting: %ju.%02u %% "
- "(%d/%d) done",
+ "(%u/%d) done",
(uintmax_t)(percentage /
(0x10000 * 100)),
(unsigned)((percentage /
More information about the svn-src-head
mailing list