Date: Fri, 7 Jul 2017 15:22:29 +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-10@freebsd.org Subject: svn commit: r320781 - stable/10/sbin/camcontrol Message-ID: <201707071522.v67FMTs9066082@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Fri Jul 7 15:22:29 2017 New Revision: 320781 URL: https://svnweb.freebsd.org/changeset/base/320781 Log: MFC r319337: Fix integer overflow in "camcontrol format" Reported by: Coverity CID: 1011426 Sponsored by: Spectra Logic Corp Modified: stable/10/sbin/camcontrol/camcontrol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/10/sbin/camcontrol/camcontrol.c Fri Jul 7 15:09:08 2017 (r320780) +++ stable/10/sbin/camcontrol/camcontrol.c Fri Jul 7 15:22:29 2017 (r320781) @@ -6044,15 +6044,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?201707071522.v67FMTs9066082>