Hi, [FYI, it's a private test report for your RFC patch.] [auto build test WARNING on linus/master] [also build test WARNING on v5.5-rc3] [cannot apply to tip/x86/core tip/x86/mm efi/next next-20191220] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/glider-google-com/Add-KernelMemorySanitizer-infrastructure/20191224-024330 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 46cf053efec6a3a5f343fead837777efe8252a46 config: xtensa-common_defconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 7.5.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.5.0 make.cross ARCH=xtensa If you fix the issue, kindly add following tag Reported-by: kbuild test robot Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers/char/hw_random/core.c: In function 'rng_dev_read': >> drivers/char/hw_random/core.c:251:7: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(buf + ret, rng_buffer + data_avail, ^ -- In file included from include/linux/crypto.h:21:0, from include/crypto/hash.h:11, from include/linux/uio.h:10, from include/linux/socket.h:8, from include/linux/compat.h:15, from include/linux/ethtool.h:17, from net//core/ethtool.c:14: include/linux/uaccess.h: In function '_copy_to_user': include/linux/uaccess.h:155:9: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] return res; ^~~ net//core/ethtool.c: In function 'ethtool_get_per_queue_coalesce': >> net//core/ethtool.c:2362:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &coalesce, sizeof(coalesce))) ^ net//core/ethtool.c: In function 'ethtool_get_value': net//core/ethtool.c:2015:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &edata, sizeof(edata))) ^ net//core/ethtool.c: In function 'ethtool_get_channels': net//core/ethtool.c:1675:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &channels, sizeof(channels))) ^ net//core/ethtool.c: In function 'ethtool_get_coalesce': net//core/ethtool.c:1610:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &coalesce, sizeof(coalesce))) ^ net//core/ethtool.c: In function 'store_link_ksettings_for_user.constprop': net//core/ethtool.c:603:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(to, &link_usettings, sizeof(link_usettings))) ^ net//core/ethtool.c: In function 'ethtool_get_drvinfo': net//core/ethtool.c:810:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &info, sizeof(info))) ^ net//core/ethtool.c: In function 'ethtool_get_settings': net//core/ethtool.c:727:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &cmd, sizeof(cmd))) ^ net//core/ethtool.c: In function 'ethtool_get_any_eeprom': net//core/ethtool.c:1533:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &eeprom, sizeof(eeprom))) ^ net//core/ethtool.c:1522:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(userbuf, data, eeprom.len)) { ^ net//core/ethtool.c: In function 'ethtool_set_rxnfc': net//core/ethtool.c:896:33: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (cmd == ETHTOOL_SRXCLSRLINS && ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ copy_to_user(useraddr, &info, info_size)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net//core/ethtool.c: In function 'ethtool_get_rxfh': net//core/ethtool.c:1211:12: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] } else if (copy_to_user(useraddr + ^ net//core/ethtool.c:1208:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, hfunc), ^ net//core/ethtool.c:1180:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &rxfh, sizeof(rxfh))) ^ net//core/ethtool.c: In function 'ethtool_get_rxfh_indir': net//core/ethtool.c:1071:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr + ^ net//core/ethtool.c:1052:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh_indir, size), ^ net//core/ethtool.c: In function 'ethtool_set_rxfh': net//core/ethtool.c:1318:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, rss_context), ^ net//core/ethtool.c: In function 'ethtool_get_sset_info': net//core/ethtool.c:861:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, info_buf, idx * sizeof(u32))) ^ net//core/ethtool.c:857:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &info, sizeof(info))) ^ net//core/ethtool.c: In function 'ethtool_get_rxnfc': net//core/ethtool.c:963:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, rule_buf, ^ net//core/ethtool.c:958:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &info, info_size)) ^ net//core/ethtool.c: In function 'dev_ethtool': net//core/ethtool.c:168:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &cmd, sizeof(cmd))) ^ In file included from include/linux/crypto.h:21:0, from include/crypto/hash.h:11, from include/linux/uio.h:10, from include/linux/socket.h:8, from include/linux/compat.h:15, from include/linux/ethtool.h:17, from net//core/ethtool.c:14: include/linux/uaccess.h:147:16: note: 'res' was declared here unsigned long res; ^~~ net//core/ethtool.c:639:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized] if (copy_to_user(useraddr, &link_ksettings.base, ^ In file included from include/linux/crypto.h:21:0, from include/crypto/hash.h:11, from include/linux/uio.h:10, from include/linux/socket.h:8, from include/linux/compat.h:15, from include/linux/ethtool.h:17, from net//core/ethtool.c:14: include/linux/uaccess.h:147:16: note: 'res' was declared here unsigned long res; vim +/res +251 drivers/char/hw_random/core.c 9996508b335306 Ian Molton 2009-12-01 204 844dd05fec172d Michael Buesch 2006-06-26 205 static ssize_t rng_dev_read(struct file *filp, char __user *buf, 844dd05fec172d Michael Buesch 2006-06-26 206 size_t size, loff_t *offp) 844dd05fec172d Michael Buesch 2006-06-26 207 { 844dd05fec172d Michael Buesch 2006-06-26 208 ssize_t ret = 0; 984e976f5382ff Patrick McHardy 2007-11-21 209 int err = 0; 9996508b335306 Ian Molton 2009-12-01 210 int bytes_read, len; 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 211 struct hwrng *rng; 844dd05fec172d Michael Buesch 2006-06-26 212 844dd05fec172d Michael Buesch 2006-06-26 213 while (size) { 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 214 rng = get_current_rng(); 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 215 if (IS_ERR(rng)) { 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 216 err = PTR_ERR(rng); 844dd05fec172d Michael Buesch 2006-06-26 217 goto out; 9996508b335306 Ian Molton 2009-12-01 218 } 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 219 if (!rng) { 844dd05fec172d Michael Buesch 2006-06-26 220 err = -ENODEV; 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 221 goto out; 844dd05fec172d Michael Buesch 2006-06-26 222 } 984e976f5382ff Patrick McHardy 2007-11-21 223 1ab87298cb59b6 Jiri Slaby 2015-11-27 224 if (mutex_lock_interruptible(&reading_mutex)) { 1ab87298cb59b6 Jiri Slaby 2015-11-27 225 err = -ERESTARTSYS; 1ab87298cb59b6 Jiri Slaby 2015-11-27 226 goto out_put; 1ab87298cb59b6 Jiri Slaby 2015-11-27 227 } 9996508b335306 Ian Molton 2009-12-01 228 if (!data_avail) { 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 229 bytes_read = rng_get_data(rng, rng_buffer, f7f154f1246ccc Rusty Russell 2013-03-05 230 rng_buffer_size(), 9996508b335306 Ian Molton 2009-12-01 231 !(filp->f_flags & O_NONBLOCK)); 893f1128664478 Ralph Wuerthner 2008-04-17 232 if (bytes_read < 0) { 893f1128664478 Ralph Wuerthner 2008-04-17 233 err = bytes_read; 9372b35e11149c Rusty Russell 2014-12-08 234 goto out_unlock_reading; 9996508b335306 Ian Molton 2009-12-01 235 } 9996508b335306 Ian Molton 2009-12-01 236 data_avail = bytes_read; 893f1128664478 Ralph Wuerthner 2008-04-17 237 } 844dd05fec172d Michael Buesch 2006-06-26 238 9996508b335306 Ian Molton 2009-12-01 239 if (!data_avail) { 9996508b335306 Ian Molton 2009-12-01 240 if (filp->f_flags & O_NONBLOCK) { 9996508b335306 Ian Molton 2009-12-01 241 err = -EAGAIN; 9372b35e11149c Rusty Russell 2014-12-08 242 goto out_unlock_reading; 9996508b335306 Ian Molton 2009-12-01 243 } 9996508b335306 Ian Molton 2009-12-01 244 } else { 9996508b335306 Ian Molton 2009-12-01 245 len = data_avail; 9996508b335306 Ian Molton 2009-12-01 246 if (len > size) 9996508b335306 Ian Molton 2009-12-01 247 len = size; 9996508b335306 Ian Molton 2009-12-01 248 9996508b335306 Ian Molton 2009-12-01 249 data_avail -= len; 9996508b335306 Ian Molton 2009-12-01 250 9996508b335306 Ian Molton 2009-12-01 @251 if (copy_to_user(buf + ret, rng_buffer + data_avail, 9996508b335306 Ian Molton 2009-12-01 252 len)) { 844dd05fec172d Michael Buesch 2006-06-26 253 err = -EFAULT; 9372b35e11149c Rusty Russell 2014-12-08 254 goto out_unlock_reading; 9996508b335306 Ian Molton 2009-12-01 255 } 9996508b335306 Ian Molton 2009-12-01 256 9996508b335306 Ian Molton 2009-12-01 257 size -= len; 9996508b335306 Ian Molton 2009-12-01 258 ret += len; 844dd05fec172d Michael Buesch 2006-06-26 259 } 844dd05fec172d Michael Buesch 2006-06-26 260 9372b35e11149c Rusty Russell 2014-12-08 261 mutex_unlock(&reading_mutex); 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 262 put_rng(rng); 9996508b335306 Ian Molton 2009-12-01 263 844dd05fec172d Michael Buesch 2006-06-26 264 if (need_resched()) 844dd05fec172d Michael Buesch 2006-06-26 265 schedule_timeout_interruptible(1); 9996508b335306 Ian Molton 2009-12-01 266 9996508b335306 Ian Molton 2009-12-01 267 if (signal_pending(current)) { 844dd05fec172d Michael Buesch 2006-06-26 268 err = -ERESTARTSYS; 844dd05fec172d Michael Buesch 2006-06-26 269 goto out; 844dd05fec172d Michael Buesch 2006-06-26 270 } 9996508b335306 Ian Molton 2009-12-01 271 } 844dd05fec172d Michael Buesch 2006-06-26 272 out: 844dd05fec172d Michael Buesch 2006-06-26 273 return ret ? : err; 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 274 9372b35e11149c Rusty Russell 2014-12-08 275 out_unlock_reading: 9372b35e11149c Rusty Russell 2014-12-08 276 mutex_unlock(&reading_mutex); 1ab87298cb59b6 Jiri Slaby 2015-11-27 277 out_put: 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 278 put_rng(rng); 3a2c0ba5ad00c0 Rusty Russell 2014-12-08 279 goto out; 844dd05fec172d Michael Buesch 2006-06-26 280 } 844dd05fec172d Michael Buesch 2006-06-26 281 :::::: The code at line 251 was first introduced by commit :::::: 9996508b3353063f2d6c48c1a28a84543d72d70b hwrng: core - Replace u32 in driver API with byte array :::::: TO: Ian Molton :::::: CC: Herbert Xu --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation