public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Malcolm Priestley <tvboxspy@gmail.com>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [media-dvb-usb-v2] question about value overwrite
Date: Thu, 18 May 2017 20:55:25 +0100	[thread overview]
Message-ID: <00672b5e-4cf2-e271-80c1-af5c406cdb09@gmail.com> (raw)
In-Reply-To: <20170518140901.Horde.bHPlhISMuTRMEbVjfq3p1kd@gator4166.hostgator.com>

Hi

On 18/05/17 20:09, Gustavo A. R. Silva wrote:
> 
> Hello everybody,
> 
> While looking into Coverity ID 1226934 I ran into the following piece of 
> code at drivers/media/usb/dvb-usb-v2/lmedm04.c:205
> 
> 205static int lme2510_stream_restart(struct dvb_usb_device *d)
> 206{
> 207        struct lme2510_state *st = d->priv;
> 208        u8 all_pids[] = LME_ALL_PIDS;
> 209        u8 stream_on[] = LME_ST_ON_W;
> 210        int ret;
> 211        u8 rbuff[1];
> 212        if (st->pid_off)
> 213                ret = lme2510_usb_talk(d, all_pids, sizeof(all_pids),
> 214                        rbuff, sizeof(rbuff));
> 215        /*Restart Stream Command*/
> 216        ret = lme2510_usb_talk(d, stream_on, sizeof(stream_on),
> 217                        rbuff, sizeof(rbuff));
> 218        return ret;
> 219}

It is a mistake it should have been ORed ad in |= as lme2510_usb_talk 
only returns three states.

So if an error is in the running it will be returned to user.

The first of your patches is better and more or less the same, the 
second would break driver, restart is not an else condition.

Regards


Malcolm

  reply	other threads:[~2017-05-18 19:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 19:09 [media-dvb-usb-v2] question about value overwrite Gustavo A. R. Silva
2017-05-18 19:55 ` Malcolm Priestley [this message]
2017-05-18 20:08   ` Gustavo A. R. Silva

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=00672b5e-4cf2-e271-80c1-af5c406cdb09@gmail.com \
    --to=tvboxspy@gmail.com \
    --cc=garsilva@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox