public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Vitaly Makarov <vit.macarrow@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: Non-portable code in em28XX driver
Date: Tue, 15 Feb 2011 18:46:43 -0200	[thread overview]
Message-ID: <4D5AE633.3020704@infradead.org> (raw)
In-Reply-To: <AANLkTi=4K9YM=_pVycMw0721YV_f+XR52OPb36ePED3Q@mail.gmail.com>

Em 15-02-2011 17:16, Vitaly Makarov escreveu:
> Dear Mauro,
> In your patch 12406 to v4l-dvb dev tree there is a small problem:
> --
> 
> diff -r 13a35e80e987 -r 8f9eee4fd803
> linux/drivers/media/video/em28xx/em28xx-core.c
> --- a/linux/drivers/media/video/em28xx/em28xx-core.c    Fri Aug 07 18:43:00
> 2009 -0300
> +++ b/linux/drivers/media/video/em28xx/em28xx-core.c    Sat Aug 08 03:14:55
> 2009 -0300
> @@ -720,7 +720,10 @@
>  {
>         int width, height;
>         width = norm_maxw(dev);
> -       height = norm_maxh(dev) >> 1;
> +       height = norm_maxh(dev);
> +
> +       if (!dev->progressive)
> +               height >>= norm_maxh(dev);
> 
>         em28xx_set_outfmt(dev);
> 
> --
> In the line "height >>= norm_maxh(dev)" undefined behavior has been
> introduced. There is an attempt to shift the number to a big number of
> bits which is not defined by C standard and leads to unpredictable
> results. For example it will work on Intel because there it will
> translate to no shift at all which seems to be unexpected as well. But
> if you enable global optimization or compile this code for ARM the
> result will be 0.
> It seems like this line should look like "height = norm_maxh(dev) >> 1"

Yes, I suspect so. Could you please make us a patch for it?

Thanks!
Mauro

      reply	other threads:[~2011-02-15 20:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTin8=arSRg3VLVEUmTRdYt3FzGeBZS6wvu8iEZYo@mail.gmail.com>
2011-02-15 19:16 ` Non-portable code in em28XX driver Vitaly Makarov
2011-02-15 20:46   ` Mauro Carvalho Chehab [this message]

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=4D5AE633.3020704@infradead.org \
    --to=mchehab@infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=vit.macarrow@gmail.com \
    /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