public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
From: mjn3@codepoet.org (Manuel Novoa III)
To: Riley Williams <rhw@InfraDead.Org>
Cc: linux-8086@vger.kernel.org
Subject: Re: fs/minix/bitmap.c is broken in CVS
Date: Thu, 20 Jun 2002 22:23:37 -0600	[thread overview]
Message-ID: <20020621042337.GA23253@codepoet.org> (raw)
In-Reply-To: <Pine.LNX.4.21.0206201838580.15173-100000@Consulate.UFP.CX>

Hello Riley,

On Thu, Jun 20, 2002 at 06:45:03PM +0100, Riley Williams wrote:
> Hi Manuel.
> 
> > Apparently during the recent changes, someone replaced the code
> > sequence
> >
> >    if (j == find_first_zero_bit(bh->b_data, 8192))
> >	panic("still zero bit!%d\n", j);
> >
> > with
> >
> >    j == (block_t) find_first_zero_bit(bh->b_data, 8192);
> >    if (j)
> >	panic("still zero bit!%d\n", j);
> >
> > in function minix_new_block in file fs/minix/bitmap.c.
> 
> If they did, it wouldn't compile. 

Sure it would compile.  A better compiler than bcc would probably issue
a warning because the result of the == operator would be discarded, but
it is still valid C.

>           However, there is only one = sign
> (it's the assignment operator, not the equality comparison operator
> that occurs there).

Riley, look at the code.  It is _supposed_ to be == since the intent
is to check and make sure the bit you want set by set_bit has actually
been set.  I found this because trying to write to a new file was
causing a kernel panic.

> I also replaced similar sequences elsewhere in the kernel source.

Unfortunatly, doing so can be an anti-optimization wrt size when
using bcc.  My size reduction patch probably reversed a number of
your changes.

> I've been running the ELKS kernel source through the splint source
> checking tool, and cleaning the source up so that splint doesn't report
> any warnings whatsoever in its -weak analysis mode. Here's the version
> of those two lines that reports clean as far as splint is concerned...
> 
> >    if ((j = ((block_t) find_first_zero_bit(bh->b_data, 8192))))
> >	panic("still zero bit!%d\n", j);

If you check the older versions in cvs, you'll see that it was == for
comparison, not = for assignment.

> I don't know about you, but there's far too many brackets in there for
> my liking, which is why I split it into two lines. It doesn't affect the
> code produced.

The parenthesis don't bother me as long as the code is formatted
reasonably. And there are situations were it _does_ affect the code
produced.  If you'd like, I'd be happy to provide you with some
examples.  That would have to wait until Monday or so as I am currently
on the road.

> Best wishes from Riley.

And to you,

Manuel

  reply	other threads:[~2002-06-21  4:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-18 12:24 fs/minix/bitmap.c is broken in CVS Manuel Novoa III
2002-06-20 17:45 ` Riley Williams
2002-06-21  4:23   ` Manuel Novoa III [this message]
2002-06-21 21:22     ` Riley Williams
2002-06-22  9:41     ` Riley Williams
2002-06-25 21:52       ` Manuel Novoa III
2002-06-26  3:31         ` Riley Williams
2002-06-26 17:32         ` Anybody want this stuff? Dustin Lang

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=20020621042337.GA23253@codepoet.org \
    --to=mjn3@codepoet.org \
    --cc=linux-8086@vger.kernel.org \
    --cc=rhw@InfraDead.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