Date: Mon, 31 May 2010 09:07:23 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r208670 - head/sys/dev/amdsbwd Message-ID: <201005310907.o4V97NBr020675@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Mon May 31 09:07:23 2010 New Revision: 208670 URL: http://svn.freebsd.org/changeset/base/208670 Log: amdsbwd: fix nonsensical timeout calculations in case when sub-second interval is being programmed Found by: clang static analyzer MFC after: 4 days Modified: head/sys/dev/amdsbwd/amdsbwd.c Modified: head/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- head/sys/dev/amdsbwd/amdsbwd.c Mon May 31 09:06:03 2010 (r208669) +++ head/sys/dev/amdsbwd/amdsbwd.c Mon May 31 09:07:23 2010 (r208670) @@ -230,10 +230,10 @@ amdsbwd_event(void *arg, unsigned int cm cmd &= WD_INTERVAL; if (cmd < WD_TO_1SEC) cmd = 0; - timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick; - if (timeout > sc->max_ticks) - timeout = sc->max_ticks; if (cmd) { + timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick; + if (timeout > sc->max_ticks) + timeout = sc->max_ticks; if (timeout != sc->timeout) { amdsbwd_tmr_set(sc, timeout); if (!sc->active)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005310907.o4V97NBr020675>