Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 May 2016 15:57:55 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299682 - head/usr.sbin/i2c
Message-ID:  <201605131557.u4DFvtRO002692@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Fri May 13 15:57:55 2016
New Revision: 299682
URL: https://svnweb.freebsd.org/changeset/base/299682

Log:
  i2c(8): uninitialized variable (UNINIT).
  
  If i2c_opt.width is somehow zero, buf will be left uninitialized and may
  cause trouble later on. This is a followup to r299586.
  
  CID:	1331548

Modified:
  head/usr.sbin/i2c/i2c.c

Modified: head/usr.sbin/i2c/i2c.c
==============================================================================
--- head/usr.sbin/i2c/i2c.c	Fri May 13 15:32:16 2016	(r299681)
+++ head/usr.sbin/i2c/i2c.c	Fri May 13 15:57:55 2016	(r299682)
@@ -294,8 +294,10 @@ i2c_write(char *dev, struct options i2c_
 			err_msg = "error: offset malloc";
 			goto err1;
 		}
-	} else
+	} else {
 		bufsize = 0;
+		buf = NULL;
+	}
 
 	switch(i2c_opt.mode) {
 	case I2C_MODE_STOP_START:



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