Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Oct 2014 23:48:56 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273016 - head/sys/dev/iicbus
Message-ID:  <201410122348.s9CNmuuJ057586@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Sun Oct 12 23:48:55 2014
New Revision: 273016
URL: https://svnweb.freebsd.org/changeset/base/273016

Log:
  Check error return from reading integer part of temperature.
  
  There's a very remote, but possible, chance that the integer part read will
  fail, but the fraction read succeeds, at which point the reported temperature is
  invalid.
  
  Reported by: Matthew Rezny
  MFC after:	3 weeks

Modified:
  head/sys/dev/iicbus/max6690.c

Modified: head/sys/dev/iicbus/max6690.c
==============================================================================
--- head/sys/dev/iicbus/max6690.c	Sun Oct 12 23:46:24 2014	(r273015)
+++ head/sys/dev/iicbus/max6690.c	Sun Oct 12 23:48:55 2014	(r273016)
@@ -340,6 +340,10 @@ max6690_sensor_read(struct max6690_senso
 	}
 
 	err = max6690_read(sc->sc_dev, sc->sc_addr, reg_int, &integer);
+
+	if (err < 0)
+		return (-1);
+
 	err = max6690_read(sc->sc_dev, sc->sc_addr, reg_ext, &fraction);
 
 	if (err < 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410122348.s9CNmuuJ057586>