All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: Dan Carpenter <error27@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: dereferencing uninitialized variable in anysee_probe()
Date: Mon, 31 May 2010 18:22:49 +0300	[thread overview]
Message-ID: <4C03D449.2020507@iki.fi> (raw)
In-Reply-To: <20100531150914.GX5483@bicker>

Terve Dan,

On 05/31/2010 06:09 PM, Dan Carpenter wrote:
> Hi I'm going through some smatch stuff and I had a question.
>
> drivers/media/dvb/dvb-usb/anysee.c +482 anysee_probe(30)
> 	warn: variable dereferenced before check 'd'
>
>     466          ret = dvb_usb_device_init(intf,&anysee_properties, THIS_MODULE,&d,
>     467                  adapter_nr);
>
> 	If we're in a cold state then dvb_usb_device_init() can return
> 	zero but d is uninitialized here.

Anysee is always warm. Its USB-bridge, Cypress FX2, uploads firmware 
from eeprom and due to that it is never cold from the drivers point of view.

*cold means device needs firmware upload from driver
*warm means device is ready. Firmware is already uploaded or it is not 
needed at all.

>     468          if (ret)
>     469                  return ret;
>     470
>     471          alt = usb_altnum_to_altsetting(intf, 0);
>     472          if (alt == NULL) {
>     473                  deb_info("%s: no alt found!\n", __func__);
>     474                  return -ENODEV;
>     475          }
>     476
>     477          ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
>                                          ^^^^^^^
> 	That would lead to an oops here.
>
>     478                  alt->desc.bAlternateSetting);
>
> I'm not sure how to fix this.

After that answer, do you still see problem?

best regards
Antti
-- 
http://palosaari.fi/

  reply	other threads:[~2010-05-31 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-31 15:09 dereferencing uninitialized variable in anysee_probe() Dan Carpenter
2010-05-31 15:22 ` Antti Palosaari [this message]
2010-05-31 19:13   ` 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=4C03D449.2020507@iki.fi \
    --to=crope@iki.fi \
    --cc=error27@gmail.com \
    --cc=linux-media@vger.kernel.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.