mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mru@inprovide.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] embarassing typo
Date: Wed, 30 Mar 2005 05:35:54 +0200	[thread overview]
Message-ID: <yw1x8y45ztyd.fsf@ford.inprovide.com> (raw)
In-Reply-To: <200503292331.46832.vicente.feito@gmail.com>

Vicente Feito <vicente.feito@gmail.com> writes:

> On Tuesday 29 March 2005 09:58 pm, you wrote:
>> Måns Rullgård wrote:
>> > "Ronald S. Bultje" <rbultje@ronald.bitfreak.net> writes:
>> >>--- linux-2.6.5/drivers/media/video/zr36050.c.old 16 Sep 2004 22:53:27
>> >> -0000 1.2 +++ linux-2.6.5/drivers/media/video/zr36050.c 29 Mar 2005
>> >> 20:30:23 -0000 @@ -419,7 +419,7 @@
>> >>  dri_data[2] = 0x00;
>> >>  dri_data[3] = 0x04;
>> >>  dri_data[4] = ptr->dri >> 8;
>> >>- dri_data[5] = ptr->dri * 0xff;
>> >>+ dri_data[5] = ptr->dri & 0xff;
>> >
>> > Hey, that's a nice obfuscation of a simple negation.
>>
>> It's not a negation.  This statement always assigns zero to
>> dri_data[5] if dri_data is char[].  Looks like gcc isn't catching
>> this problem.
>>
> As long as the variable doesn't get overflowed you would have a
> negation, you shouldn't do dri_data[5] = ptr->dri * 0xff; if
> ptr->dri it's 255, but if ptr->dri = 1 i.e. (like is set in
> zr36050_setup) then you would be getting the negation, -1. the
> Direct rendering support is a flag afaik, so in this case I believe
> is a worthy C obfuscated negation code :)
> btw, are you sure about this patch?I would contact the maintainer
> first, because and'ing that doesn't make much sense...

It seems pretty obvious to me, that the code is supposed to store the
high byte in dri_data[4], and the low byte in dri_data[5].  Mistyping
& as * doesn't seem too unlikely, either.

-- 
Måns Rullgård
mru@inprovide.com


  reply	other threads:[~2005-03-30  3:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-29 23:31 Vicente Feito
2005-03-30  3:35 ` Måns Rullgård [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-03-29 20:36 Ronald S. Bultje
2005-03-29 21:02 ` Måns Rullgård
2005-03-29 21:58   ` Michael Tokarev
2005-03-30  1:40     ` Dmitry Torokhov
2005-03-30  5:53       ` Gene Heskett
2005-03-30 23:38         ` John Pearson
2005-03-31  4:16           ` Gene Heskett
2005-03-30  2:07     ` Måns Rullgård
2005-03-30  3:34       ` Phil Howard

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=yw1x8y45ztyd.fsf@ford.inprovide.com \
    --to=mru@inprovide.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®