Date: Thu, 25 Jul 2019 20:26:22 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350333 - head/sys/dev/nvme Message-ID: <201907252026.x6PKQMIk092730@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Thu Jul 25 20:26:21 2019 New Revision: 350333 URL: https://svnweb.freebsd.org/changeset/base/350333 Log: Widen the type for to. The timeout field in the CAPS register is defined to be 8 bits, so its type was uint8_t. We recently started adding 1 to it to cope with rogue devices that listed 0 timeout time (which is impossible). However, in so doing, other devices that list 0xff (for a 2 minute timeout) were broken when adding 1 overflowed. Widen the type to be uint32_t like its source register to avoid the issue. Reported by: bapt@ Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jul 25 20:01:24 2019 (r350332) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jul 25 20:26:21 2019 (r350333) @@ -1227,7 +1227,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de struct make_dev_args md_args; uint32_t cap_lo; uint32_t cap_hi; - uint8_t to; + uint32_t to; uint8_t dstrd; uint8_t mpsmin; int status, timeout_period;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907252026.x6PKQMIk092730>