[tiwai-sound:for-next 17/18] sound/usb/usx2y/us144mkii_midi.c:65 tascam_midi_in_urb_complete() error: we previously assumed 'tascam' could be null (see line 54)

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
head:   d9f0633867711cff87c5604a4f90daa8ab986e4f
commit: 0ec417aa85467c6fad0563621b74868be0faf00d [17/18] ALSA: usb-audio: Add infrastructure for TASCAM US-144MKII
config: powerpc64-randconfig-r073-20250819 (https://download.01.org/0day-ci/archive/20250819/202508192109.lcMrINK1-lkp@xxxxxxxxx/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 93d24b6b7b148c47a2fa228a4ef31524fa1d9f3f)

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>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202508192109.lcMrINK1-lkp@xxxxxxxxx/

smatch warnings:
sound/usb/usx2y/us144mkii_midi.c:65 tascam_midi_in_urb_complete() error: we previously assumed 'tascam' could be null (see line 54)

vim +/tascam +65 sound/usb/usx2y/us144mkii_midi.c

67afec157fe63d Šerif Rami 2025-08-14  38  
67afec157fe63d Šerif Rami 2025-08-14  39  void tascam_midi_in_urb_complete(struct urb *urb)
67afec157fe63d Šerif Rami 2025-08-14  40  {
67afec157fe63d Šerif Rami 2025-08-14  41  	struct tascam_card *tascam = urb->context;
67afec157fe63d Šerif Rami 2025-08-14  42  	int ret;
67afec157fe63d Šerif Rami 2025-08-14  43  
67afec157fe63d Šerif Rami 2025-08-14  44  	if (urb->status) {
67afec157fe63d Šerif Rami 2025-08-14  45  		if (urb->status != -ENOENT && urb->status != -ECONNRESET &&
67afec157fe63d Šerif Rami 2025-08-14  46  		    urb->status != -ESHUTDOWN && urb->status != -EPROTO) {
67afec157fe63d Šerif Rami 2025-08-14  47  			dev_err_ratelimited(tascam->card->dev,
                                                                                    ^^^^^^^^^^^^
Unchecked dereference.

67afec157fe63d Šerif Rami 2025-08-14  48  					    "MIDI IN URB failed: status %d\n",
67afec157fe63d Šerif Rami 2025-08-14  49  					    urb->status);
67afec157fe63d Šerif Rami 2025-08-14  50  		}
67afec157fe63d Šerif Rami 2025-08-14  51  		goto out;
67afec157fe63d Šerif Rami 2025-08-14  52  	}
67afec157fe63d Šerif Rami 2025-08-14  53  
67afec157fe63d Šerif Rami 2025-08-14 @54  	if (tascam && atomic_read(&tascam->midi_in_active) &&
                                                    ^^^^^^
Is this required?

67afec157fe63d Šerif Rami 2025-08-14  55  	    urb->actual_length > 0) {
67afec157fe63d Šerif Rami 2025-08-14  56  		kfifo_in_spinlocked(&tascam->midi_in_fifo, urb->transfer_buffer,
67afec157fe63d Šerif Rami 2025-08-14  57  				    urb->actual_length, &tascam->midi_in_lock);
67afec157fe63d Šerif Rami 2025-08-14  58  		schedule_work(&tascam->midi_in_work);
67afec157fe63d Šerif Rami 2025-08-14  59  	}
67afec157fe63d Šerif Rami 2025-08-14  60  
67afec157fe63d Šerif Rami 2025-08-14  61  	usb_get_urb(urb);
67afec157fe63d Šerif Rami 2025-08-14  62  	usb_anchor_urb(urb, &tascam->midi_in_anchor);
                                                                     ^^^^^^^^
Unchecked dereference.

67afec157fe63d Šerif Rami 2025-08-14  63  	ret = usb_submit_urb(urb, GFP_ATOMIC);
67afec157fe63d Šerif Rami 2025-08-14  64  	if (ret < 0) {
67afec157fe63d Šerif Rami 2025-08-14 @65  		dev_err(tascam->card->dev,
67afec157fe63d Šerif Rami 2025-08-14  66  			"Failed to resubmit MIDI IN URB: error %d\n", ret);
67afec157fe63d Šerif Rami 2025-08-14  67  		usb_unanchor_urb(urb);
67afec157fe63d Šerif Rami 2025-08-14  68  		usb_put_urb(urb);
67afec157fe63d Šerif Rami 2025-08-14  69  	}
67afec157fe63d Šerif Rami 2025-08-14  70  out:
67afec157fe63d Šerif Rami 2025-08-14  71  	usb_put_urb(urb);
67afec157fe63d Šerif Rami 2025-08-14  72  }

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




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux