[dtor-input:next 104/120] drivers/input/serio/serio_raw.c:204:12: warning: variable 'written' is uninitialized when used here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
head:   00850d7b542aa4a8240cf977d43dc6d2158e48d7
commit: 5b53a9d40c4f83b44de8da06af9a9c9b3fb14988 [104/120] Input: serio_raw - use guard notation for locks and other resources
config: i386-buildonly-randconfig-002-20241019 (https://download.01.org/0day-ci/archive/20241020/202410201730.ItNhUTIv-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241020/202410201730.ItNhUTIv-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410201730.ItNhUTIv-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/input/serio/serio_raw.c:204:12: warning: variable 'written' is uninitialized when used here [-Wuninitialized]
     204 |                                 return written ?: -EIO;
         |                                        ^~~~~~~
   drivers/input/serio/serio_raw.c:188:13: note: initialize the variable 'written' to silence this warning
     188 |         int written;
         |                    ^
         |                     = 0
   1 warning generated.


vim +/written +204 drivers/input/serio/serio_raw.c

   182	
   183	static ssize_t serio_raw_write(struct file *file, const char __user *buffer,
   184				       size_t count, loff_t *ppos)
   185	{
   186		struct serio_raw_client *client = file->private_data;
   187		struct serio_raw *serio_raw = client->serio_raw;
   188		int written;
   189		unsigned char c;
   190	
   191		scoped_guard(mutex_intr, &serio_raw_mutex) {
   192			if (serio_raw->dead)
   193				return -ENODEV;
   194	
   195			if (count > 32)
   196				count = 32;
   197	
   198			while (count--) {
   199				if (get_user(c, buffer++))
   200					return -EFAULT;
   201	
   202				if (serio_write(serio_raw->serio, c)) {
   203					/* Either signal error or partial write */
 > 204					return written ?: -EIO;
   205				}
   206	
   207				written++;
   208			}
   209	
   210			return written;
   211		}
   212	
   213		return -EINTR;
   214	}
   215	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux