linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [BUG?] do_generic_direct_write
Date: Sat, 28 Jun 2003 01:36:49 +0200	[thread overview]
Message-ID: <20030627233649.GC9706@werewolf.able.es> (raw)
In-Reply-To: <Pine.LNX.4.55L.0306261858460.10651@freak.distro.conectiva>; from marcelo@conectiva.com.br on Fri, Jun 27, 2003 at 00:03:02 +0200


On 06.27, Marcelo Tosatti wrote:
> 
> Hello,
> 
> Here goes -pre2 with a big number of changes, including the new aic7xxx
> driver.
> 
> I wont accept any big changes after -pre4: I want 2.4.22 timecycle to be
> short.
> 

Correct me if I'm wrong. I found this just by chance:

mm/filemap.c:
ssize_t
do_generic_direct_write(struct file *file,const char *buf,size_t count, loff_t *ppos)
...

    if (!file->f_flags & O_DIRECT)
        BUG();

This fails to trigger the BUG() just when it should. This should be:

    if (!(file->f_flags & O_DIRECT))
        BUG();

To check my C, I tried this:

#include <stdio.h>

#define O_D 2

int main()
{
    int flags;

    flags = O_D +4;
    printf("%d\n",!flags & O_D);
    printf("%d\n",!(flags & O_D));
    flags = 1+4;
    printf("%d\n",!flags & O_D);
    printf("%d\n",!(flags & O_D));

    return 0;
}

Output:

werewolf:~# ./kk
0
0
0
1

So it gives 0 when 'flags' != 0, not regarding if O_D is there or not....

Correct ?

One other job for the Stanford checker... ?

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.2 (Cooker) for i586
Linux 2.4.21-jam1 (gcc 3.3 (Mandrake Linux 9.2 3.3-2mdk))

  parent reply	other threads:[~2003-06-27 23:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-26 22:03 Linux 2.4.22-pre2 Marcelo Tosatti
2003-06-26 22:54 ` J.A. Magallon
2003-06-26 23:06 ` [PATCH] gcc_check for x86 J.A. Magallon
2003-06-26 23:08 ` [PATCH] fix inlining with gcc3 J.A. Magallon
2003-06-26 23:36   ` Kurt Wall
2003-06-27 10:50   ` Alan Cox
2003-06-27 14:22     ` J.A. Magallon
2003-06-26 23:31 ` [PATCH] kill extra printk prototype J.A. Magallon
2003-06-27 14:02   ` Adrian Bunk
2003-06-26 23:32 ` [PATCH] kill duplicate pci_id J.A. Magallon
2003-06-27  5:59 ` Linux 2.4.22-pre2 Marc-Christian Petersen
2003-06-27  8:44 ` Matthias Andree
2003-06-27 17:58 ` [2.4 patch] some gcc 3.3 fixes from -ac Adrian Bunk
2003-06-27 18:56 ` Linux 2.4.22-pre2 Alessandro Suardi
2003-06-27 23:36 ` J.A. Magallon [this message]
2003-07-04 20:55   ` [BUG?] do_generic_direct_write J.A. Magallon
2003-06-27 23:38 ` Linux 2.4.22-pre2 Krzysztof Halasa

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=20030627233649.GC9706@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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;
as well as URLs for NNTP newsgroup(s).