From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [android-common:android12-5.4 8477/13064] sound/usb/pcm.c:1033 snd_usb_pcm_prepare() warn: variable dereferenced before check 'subs->cur_audiofmt' (see line 1029)
Date: Mon, 28 Dec 2020 06:01:32 +0800 [thread overview]
Message-ID: <202012280618.HbrjitRQ-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 8921 bytes --]
CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
tree: https://android.googlesource.com/kernel/common android12-5.4
head: b69d75c07de5c55d7a85312132f8544bbf2f3561
commit: fd98495a63a8e99ae4b6802b73295ef997684d73 [8477/13064] ANDROID: sound: usb: Add vendor's hooking interface
:::::: branch date: 4 days ago
:::::: commit date: 6 months ago
config: x86_64-randconfig-m001-20201227 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
sound/usb/pcm.c:1033 snd_usb_pcm_prepare() warn: variable dereferenced before check 'subs->cur_audiofmt' (see line 1029)
Old smatch warnings:
sound/usb/pcm.c:787 configure_sync_endpoint() warn: variable dereferenced before check 'subs->stream' (see line 784)
vim +1033 sound/usb/pcm.c
e5779998bf8b70e Daniel Mack 2010-03-04 1015
e5779998bf8b70e Daniel Mack 2010-03-04 1016 /*
e5779998bf8b70e Daniel Mack 2010-03-04 1017 * prepare callback
e5779998bf8b70e Daniel Mack 2010-03-04 1018 *
e5779998bf8b70e Daniel Mack 2010-03-04 1019 * only a few subtle things...
e5779998bf8b70e Daniel Mack 2010-03-04 1020 */
e5779998bf8b70e Daniel Mack 2010-03-04 1021 static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
e5779998bf8b70e Daniel Mack 2010-03-04 1022 {
e5779998bf8b70e Daniel Mack 2010-03-04 1023 struct snd_pcm_runtime *runtime = substream->runtime;
e5779998bf8b70e Daniel Mack 2010-03-04 1024 struct snd_usb_substream *subs = runtime->private_data;
61a709504b07911 Dylan Reid 2012-09-18 1025 struct usb_host_interface *alts;
61a709504b07911 Dylan Reid 2012-09-18 1026 struct usb_interface *iface;
61a709504b07911 Dylan Reid 2012-09-18 1027 int ret;
e5779998bf8b70e Daniel Mack 2010-03-04 1028
fd98495a63a8e99 JaeHun Jung 2020-05-26 @1029 ret = snd_vendor_set_pcm_buf(subs->dev, subs->cur_audiofmt->iface);
fd98495a63a8e99 JaeHun Jung 2020-05-26 1030 if (ret)
fd98495a63a8e99 JaeHun Jung 2020-05-26 1031 return ret;
fd98495a63a8e99 JaeHun Jung 2020-05-26 1032
e5779998bf8b70e Daniel Mack 2010-03-04 @1033 if (! subs->cur_audiofmt) {
0ba41d917eeb87f Takashi Iwai 2014-02-26 1034 dev_err(&subs->dev->dev, "no format is specified!\n");
e5779998bf8b70e Daniel Mack 2010-03-04 1035 return -ENXIO;
e5779998bf8b70e Daniel Mack 2010-03-04 1036 }
e5779998bf8b70e Daniel Mack 2010-03-04 1037
47ab154593827b1 Takashi Iwai 2015-08-25 1038 ret = snd_usb_lock_shutdown(subs->stream->chip);
47ab154593827b1 Takashi Iwai 2015-08-25 1039 if (ret < 0)
47ab154593827b1 Takashi Iwai 2015-08-25 1040 return ret;
978520b75f0a1ce Takashi Iwai 2012-10-12 1041 if (snd_BUG_ON(!subs->data_endpoint)) {
978520b75f0a1ce Takashi Iwai 2012-10-12 1042 ret = -EIO;
978520b75f0a1ce Takashi Iwai 2012-10-12 1043 goto unlock;
978520b75f0a1ce Takashi Iwai 2012-10-12 1044 }
edcd3633e72a159 Daniel Mack 2012-04-12 1045
f58161ba1b05a96 Takashi Iwai 2012-11-08 1046 snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
f58161ba1b05a96 Takashi Iwai 2012-11-08 1047 snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
f58161ba1b05a96 Takashi Iwai 2012-11-08 1048
a0a4959eb4e94ce Jorge Sanjuan 2018-07-31 1049 ret = snd_usb_pcm_change_state(subs, UAC3_PD_STATE_D0);
a0a4959eb4e94ce Jorge Sanjuan 2018-07-31 1050 if (ret < 0)
a0a4959eb4e94ce Jorge Sanjuan 2018-07-31 1051 goto unlock;
a0a4959eb4e94ce Jorge Sanjuan 2018-07-31 1052
61a709504b07911 Dylan Reid 2012-09-18 1053 ret = set_format(subs, subs->cur_audiofmt);
61a709504b07911 Dylan Reid 2012-09-18 1054 if (ret < 0)
978520b75f0a1ce Takashi Iwai 2012-10-12 1055 goto unlock;
61a709504b07911 Dylan Reid 2012-09-18 1056
1e2e3fe480064ca Daniel Girnus 2016-12-06 1057 if (subs->need_setup_ep) {
1e2e3fe480064ca Daniel Girnus 2016-12-06 1058
61a709504b07911 Dylan Reid 2012-09-18 1059 iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
61a709504b07911 Dylan Reid 2012-09-18 1060 alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
61a709504b07911 Dylan Reid 2012-09-18 1061 ret = snd_usb_init_sample_rate(subs->stream->chip,
61a709504b07911 Dylan Reid 2012-09-18 1062 subs->cur_audiofmt->iface,
61a709504b07911 Dylan Reid 2012-09-18 1063 alts,
61a709504b07911 Dylan Reid 2012-09-18 1064 subs->cur_audiofmt,
61a709504b07911 Dylan Reid 2012-09-18 1065 subs->cur_rate);
61a709504b07911 Dylan Reid 2012-09-18 1066 if (ret < 0)
978520b75f0a1ce Takashi Iwai 2012-10-12 1067 goto unlock;
61a709504b07911 Dylan Reid 2012-09-18 1068
fd98495a63a8e99 JaeHun Jung 2020-05-26 1069 if (snd_vendor_get_ops()) {
fd98495a63a8e99 JaeHun Jung 2020-05-26 1070 ret = snd_vendor_set_rate(iface,
fd98495a63a8e99 JaeHun Jung 2020-05-26 1071 subs->cur_audiofmt->iface,
fd98495a63a8e99 JaeHun Jung 2020-05-26 1072 subs->cur_rate,
fd98495a63a8e99 JaeHun Jung 2020-05-26 1073 subs->cur_audiofmt->altsetting);
fd98495a63a8e99 JaeHun Jung 2020-05-26 1074 if (!ret) {
fd98495a63a8e99 JaeHun Jung 2020-05-26 1075 subs->need_setup_ep = false;
fd98495a63a8e99 JaeHun Jung 2020-05-26 1076 goto unlock;
fd98495a63a8e99 JaeHun Jung 2020-05-26 1077 }
fd98495a63a8e99 JaeHun Jung 2020-05-26 1078 }
fd98495a63a8e99 JaeHun Jung 2020-05-26 1079
61a709504b07911 Dylan Reid 2012-09-18 1080 ret = configure_endpoint(subs);
61a709504b07911 Dylan Reid 2012-09-18 1081 if (ret < 0)
978520b75f0a1ce Takashi Iwai 2012-10-12 1082 goto unlock;
384dc085c32285e Takashi Iwai 2012-09-18 1083 subs->need_setup_ep = false;
384dc085c32285e Takashi Iwai 2012-09-18 1084 }
61a709504b07911 Dylan Reid 2012-09-18 1085
e5779998bf8b70e Daniel Mack 2010-03-04 1086 /* some unit conversions in runtime */
edcd3633e72a159 Daniel Mack 2012-04-12 1087 subs->data_endpoint->maxframesize =
edcd3633e72a159 Daniel Mack 2012-04-12 1088 bytes_to_frames(runtime, subs->data_endpoint->maxpacksize);
edcd3633e72a159 Daniel Mack 2012-04-12 1089 subs->data_endpoint->curframesize =
edcd3633e72a159 Daniel Mack 2012-04-12 1090 bytes_to_frames(runtime, subs->data_endpoint->curpacksize);
e5779998bf8b70e Daniel Mack 2010-03-04 1091
e5779998bf8b70e Daniel Mack 2010-03-04 1092 /* reset the pointer */
e5779998bf8b70e Daniel Mack 2010-03-04 1093 subs->hwptr_done = 0;
e5779998bf8b70e Daniel Mack 2010-03-04 1094 subs->transfer_done = 0;
294c4fb8ab01728 Pierre-Louis Bossart 2011-09-06 1095 subs->last_delay = 0;
294c4fb8ab01728 Pierre-Louis Bossart 2011-09-06 1096 subs->last_frame_number = 0;
e5779998bf8b70e Daniel Mack 2010-03-04 1097 runtime->delay = 0;
e5779998bf8b70e Daniel Mack 2010-03-04 1098
edcd3633e72a159 Daniel Mack 2012-04-12 1099 /* for playback, submit the URBs now; otherwise, the first hwptr_done
edcd3633e72a159 Daniel Mack 2012-04-12 1100 * updates for all URBs would happen at the same time when starting */
edcd3633e72a159 Daniel Mack 2012-04-12 1101 if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)
1d0f953086f090a Ioan-Adrian Ratiu 2017-01-05 1102 ret = start_endpoints(subs);
edcd3633e72a159 Daniel Mack 2012-04-12 1103
978520b75f0a1ce Takashi Iwai 2012-10-12 1104 unlock:
47ab154593827b1 Takashi Iwai 2015-08-25 1105 snd_usb_unlock_shutdown(subs->stream->chip);
978520b75f0a1ce Takashi Iwai 2012-10-12 1106 return ret;
e5779998bf8b70e Daniel Mack 2010-03-04 1107 }
e5779998bf8b70e Daniel Mack 2010-03-04 1108
:::::: The code at line 1033 was first introduced by commit
:::::: e5779998bf8b70e48a6cc208c8b61b33bd6117ea ALSA: usb-audio: refactor code
:::::: TO: Daniel Mack <daniel@caiaq.de>
:::::: CC: Takashi Iwai <tiwai@suse.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36698 bytes --]
next reply other threads:[~2020-12-27 22:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-27 22:01 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-01-05 11:48 [android-common:android12-5.4 8477/13064] sound/usb/pcm.c:1033 snd_usb_pcm_prepare() warn: variable dereferenced before check 'subs->cur_audiofmt' (see line 1029) Dan Carpenter
2021-01-05 11:48 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202012280618.HbrjitRQ-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.