Date: Wed, 5 Jul 2017 15:34:06 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320677 - stable/11/sbin/camcontrol Message-ID: <201707051534.v65FY6vR068224@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Wed Jul 5 15:34:06 2017 New Revision: 320677 URL: https://svnweb.freebsd.org/changeset/base/320677 Log: MFC r319337: Fix integer overflow in "camcontrol format" Reported by: Coverity CID: 1011426 Sponsored by: Spectra Logic Corp Modified: stable/11/sbin/camcontrol/camcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Wed Jul 5 15:31:42 2017 (r320676) +++ stable/11/sbin/camcontrol/camcontrol.c Wed Jul 5 15:34:06 2017 (r320677) @@ -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 /
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707051534.v65FY6vR068224>