From 48235fe344156b05e836d9b963232bd13149069d Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Fri, 13 May 2016 15:57:55 +0000 Subject: [PATCH] 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 --- usr.sbin/i2c/i2c.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 744fefc7121..7714cf0b0e9 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -294,8 +294,10 @@ i2c_write(char *dev, struct options i2c_opt, char *i2c_buf) err_msg = "error: offset malloc"; goto err1; } - } else + } else { bufsize = 0; + buf = NULL; + } switch(i2c_opt.mode) { case I2C_MODE_STOP_START: