tree: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git topic/midi20 head: cc8e2c3b2d2b9c2af16151d30335492e2d0e3240 commit: e046e543faaff41051415c97bcce0b8b31d3b3f9 [20/36] ALSA: seq: Check the conflicting port at port creation config: hexagon-randconfig-r016-20230517 compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=e... git remote add tiwai-sound https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git git fetch --no-tags tiwai-sound topic/midi20 git checkout e046e543faaff41051415c97bcce0b8b31d3b3f9 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash sound/core/seq/
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202305192228.T2dDkOaw-lkp@intel.com/
All warnings (new ones prefixed by >>):
sound/core/seq/seq_ports.c:138:37: warning: variable 'num' is uninitialized when used here [-Wuninitialized]
sprintf(new_port->name, "port-%d", num); ^~~ sound/core/seq/seq_ports.c:117:9: note: initialize the variable 'num' to silence this warning int num; ^ = 0 1 warning generated.
vim +/num +138 sound/core/seq/seq_ports.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 108 ^1da177e4c3f41 Linus Torvalds 2005-04-16 109 e046e543faaff4 Takashi Iwai 2023-01-05 110 /* create a port, port number or a negative error code is returned 71105998845fb0 Takashi Iwai 2017-10-09 111 * the caller needs to unref the port via snd_seq_port_unlock() appropriately 71105998845fb0 Takashi Iwai 2017-10-09 112 */ e046e543faaff4 Takashi Iwai 2023-01-05 113 int snd_seq_create_port(struct snd_seq_client *client, int port, e046e543faaff4 Takashi Iwai 2023-01-05 114 struct snd_seq_client_port **port_ret) ^1da177e4c3f41 Linus Torvalds 2005-04-16 115 { 9244b2c3079faa Johannes Berg 2006-10-05 116 struct snd_seq_client_port *new_port, *p; e046e543faaff4 Takashi Iwai 2023-01-05 117 int num; e046e543faaff4 Takashi Iwai 2023-01-05 118 e046e543faaff4 Takashi Iwai 2023-01-05 119 *port_ret = NULL; ^1da177e4c3f41 Linus Torvalds 2005-04-16 120 ^1da177e4c3f41 Linus Torvalds 2005-04-16 121 /* sanity check */ 7eaa943c8ed8e9 Takashi Iwai 2008-08-08 122 if (snd_BUG_ON(!client)) e046e543faaff4 Takashi Iwai 2023-01-05 123 return -EINVAL; ^1da177e4c3f41 Linus Torvalds 2005-04-16 124 de20b572a30ac3 Clemens Ladisch 2015-01-25 125 if (client->num_ports >= SNDRV_SEQ_MAX_PORTS) { 04cc79a048ee21 Takashi Iwai 2014-02-04 126 pr_warn("ALSA: seq: too many ports for client %d\n", client->number); e046e543faaff4 Takashi Iwai 2023-01-05 127 return -EINVAL; ^1da177e4c3f41 Linus Torvalds 2005-04-16 128 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 129 ^1da177e4c3f41 Linus Torvalds 2005-04-16 130 /* create a new port */ ecca82b4b447f8 Takashi Iwai 2005-09-09 131 new_port = kzalloc(sizeof(*new_port), GFP_KERNEL); 24db8bbaa3fcfa Takashi Iwai 2015-03-10 132 if (!new_port) e046e543faaff4 Takashi Iwai 2023-01-05 133 return -ENOMEM; /* failure, out of memory */ ^1da177e4c3f41 Linus Torvalds 2005-04-16 134 /* init port data */ ^1da177e4c3f41 Linus Torvalds 2005-04-16 135 new_port->addr.client = client->number; ^1da177e4c3f41 Linus Torvalds 2005-04-16 136 new_port->addr.port = -1; ^1da177e4c3f41 Linus Torvalds 2005-04-16 137 new_port->owner = THIS_MODULE; ^1da177e4c3f41 Linus Torvalds 2005-04-16 @138 sprintf(new_port->name, "port-%d", num); ^1da177e4c3f41 Linus Torvalds 2005-04-16 139 snd_use_lock_init(&new_port->use_lock); ^1da177e4c3f41 Linus Torvalds 2005-04-16 140 port_subs_info_init(&new_port->c_src); ^1da177e4c3f41 Linus Torvalds 2005-04-16 141 port_subs_info_init(&new_port->c_dest); 71105998845fb0 Takashi Iwai 2017-10-09 142 snd_use_lock_use(&new_port->use_lock); ^1da177e4c3f41 Linus Torvalds 2005-04-16 143 44d30762cde76f Guo Zhengkui 2022-05-17 144 num = max(port, 0); 1a60d4c5a0c402 Ingo Molnar 2006-01-16 145 mutex_lock(&client->ports_mutex); f823b8a75527dc Takashi Iwai 2019-03-28 146 write_lock_irq(&client->ports_lock); 9244b2c3079faa Johannes Berg 2006-10-05 147 list_for_each_entry(p, &client->ports_list_head, list) { e046e543faaff4 Takashi Iwai 2023-01-05 148 if (p->addr.port == port) { e046e543faaff4 Takashi Iwai 2023-01-05 149 num = -EBUSY; e046e543faaff4 Takashi Iwai 2023-01-05 150 goto unlock; e046e543faaff4 Takashi Iwai 2023-01-05 151 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 152 if (p->addr.port > num) ^1da177e4c3f41 Linus Torvalds 2005-04-16 153 break; ^1da177e4c3f41 Linus Torvalds 2005-04-16 154 if (port < 0) /* auto-probe mode */ ^1da177e4c3f41 Linus Torvalds 2005-04-16 155 num = p->addr.port + 1; ^1da177e4c3f41 Linus Torvalds 2005-04-16 156 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 157 /* insert the new port */ 9244b2c3079faa Johannes Berg 2006-10-05 158 list_add_tail(&new_port->list, &p->list); ^1da177e4c3f41 Linus Torvalds 2005-04-16 159 client->num_ports++; ^1da177e4c3f41 Linus Torvalds 2005-04-16 160 new_port->addr.port = num; /* store the port number in the port */ 71105998845fb0 Takashi Iwai 2017-10-09 161 sprintf(new_port->name, "port-%d", num); e046e543faaff4 Takashi Iwai 2023-01-05 162 *port_ret = new_port; e046e543faaff4 Takashi Iwai 2023-01-05 163 unlock: f823b8a75527dc Takashi Iwai 2019-03-28 164 write_unlock_irq(&client->ports_lock); 1a60d4c5a0c402 Ingo Molnar 2006-01-16 165 mutex_unlock(&client->ports_mutex); ^1da177e4c3f41 Linus Torvalds 2005-04-16 166 e046e543faaff4 Takashi Iwai 2023-01-05 167 return num; ^1da177e4c3f41 Linus Torvalds 2005-04-16 168 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 169
:::::: The code at line 138 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds torvalds@ppc970.osdl.org :::::: CC: Linus Torvalds torvalds@ppc970.osdl.org