All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [bug report] ALSA: usb-audio: More validations of descriptor units
Date: Mon, 26 Aug 2019 14:48:46 +0300	[thread overview]
Message-ID: <20190826114846.GA16466@mwanda> (raw)

Hello Takashi Iwai,

This is a semi-automatic email about new static checker warnings.

The patch 57f8770620e9: "ALSA: usb-audio: More validations of
descriptor units" from Aug 20, 2019, leads to the following Smatch
complaint:

    sound/usb/quirks.c:254 create_yamaha_midi_quirk()
    warn: variable dereferenced before check 'injd' (see line 251)

sound/usb/quirks.c
   244          /* must have some valid jack descriptors */
   245          injd = snd_usb_find_csint_desc(alts->extra, alts->extralen,
   246                                         NULL, USB_MS_MIDI_IN_JACK);
   247          outjd = snd_usb_find_csint_desc(alts->extra, alts->extralen,
   248                                          NULL, USB_MS_MIDI_OUT_JACK);
   249          if (!injd && !outjd)
                     ^^^^^^^^^^^^^
At least one must be valid.

   250                  return -ENODEV;
   250			return -ENODEV;
   251		if (!snd_usb_validate_midi_desc(injd) ||
   252		    !snd_usb_validate_midi_desc(outjd))

So this should return true/valid if the pointer is NULL?

   253			return -ENODEV;
   254		if (injd && (injd->bLength < 5 ||
   255			     (injd->bJackType != USB_MS_EMBEDDED &&
   256			      injd->bJackType != USB_MS_EXTERNAL)))

regards,
dan carpenter

             reply	other threads:[~2019-08-26 11:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 11:48 Dan Carpenter [this message]
2019-08-26 12:09 ` [bug report] ALSA: usb-audio: More validations of descriptor units Takashi Iwai

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=20190826114846.GA16466@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.