lkml.org 
[lkml]   [2003]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[BUG?] do_generic_direct_write

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))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:36    [from the cache]
©2003-2011 Jasper Spaans