All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [android-common:android-5.4-stable 8411/9669] sound/usb/pcm.c:1033 snd_usb_pcm_prepare() warn: variable dereferenced before check 'subs->cur_audiofmt' (see line 1029)
Date: Mon, 24 Aug 2020 16:12:15 +0300	[thread overview]
Message-ID: <20200824131215.GP1793@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3135 bytes --]

tree:   https://android.googlesource.com/kernel/common android-5.4-stable
head:   086e8bbff65171bb1cbdab2d7ba430155276afbe
commit: e265d59708c62d94cf4e192411aaf2a8abceab39 [8411/9669] ANDROID: sound: usb: Add vendor's hooking interface
config: x86_64-randconfig-m001-20200824 (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)

git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-5.4-stable
git checkout e265d59708c62d94cf4e192411aaf2a8abceab39
vim +1033 sound/usb/pcm.c

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  
e265d59708c62d9 JaeHun Jung          2020-05-26 @1029  	ret = snd_vendor_set_pcm_buf(subs->dev, subs->cur_audiofmt->iface);
                                                                                                ^^^^^^^^^^^^^^^^^^
Unchecked dereference

e265d59708c62d9 JaeHun Jung          2020-05-26  1030  	if (ret)
e265d59708c62d9 JaeHun Jung          2020-05-26  1031  		return ret;
e265d59708c62d9 JaeHun Jung          2020-05-26  1032  
e5779998bf8b70e Daniel Mack          2010-03-04 @1033  	if (! subs->cur_audiofmt) {
                                                            ^^^^^^^^^^^^^^^^^^^^
Checked too late.

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)) {

---
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: 34744 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [android-common:android-5.4-stable 8411/9669] sound/usb/pcm.c:1033 snd_usb_pcm_prepare() warn: variable dereferenced before check 'subs->cur_audiofmt' (see line 1029)
Date: Mon, 24 Aug 2020 16:12:15 +0300	[thread overview]
Message-ID: <20200824131215.GP1793@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3135 bytes --]

tree:   https://android.googlesource.com/kernel/common android-5.4-stable
head:   086e8bbff65171bb1cbdab2d7ba430155276afbe
commit: e265d59708c62d94cf4e192411aaf2a8abceab39 [8411/9669] ANDROID: sound: usb: Add vendor's hooking interface
config: x86_64-randconfig-m001-20200824 (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)

git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-5.4-stable
git checkout e265d59708c62d94cf4e192411aaf2a8abceab39
vim +1033 sound/usb/pcm.c

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  
e265d59708c62d9 JaeHun Jung          2020-05-26 @1029  	ret = snd_vendor_set_pcm_buf(subs->dev, subs->cur_audiofmt->iface);
                                                                                                ^^^^^^^^^^^^^^^^^^
Unchecked dereference

e265d59708c62d9 JaeHun Jung          2020-05-26  1030  	if (ret)
e265d59708c62d9 JaeHun Jung          2020-05-26  1031  		return ret;
e265d59708c62d9 JaeHun Jung          2020-05-26  1032  
e5779998bf8b70e Daniel Mack          2010-03-04 @1033  	if (! subs->cur_audiofmt) {
                                                            ^^^^^^^^^^^^^^^^^^^^
Checked too late.

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)) {

---
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: 34744 bytes --]

             reply	other threads:[~2020-08-24 13:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 13:12 Dan Carpenter [this message]
2020-08-24 13:12 ` [android-common:android-5.4-stable 8411/9669] sound/usb/pcm.c:1033 snd_usb_pcm_prepare() warn: variable dereferenced before check 'subs->cur_audiofmt' (see line 1029) Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-08-23 19:46 kernel test robot

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=20200824131215.GP1793@kadam \
    --to=dan.carpenter@oracle.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.