lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 29 May 2010 21:26:47 +0800
From:	Changli Gao <xiaosuo@...il.com>
To:	Borislav Petkov <bp@...en8.de>, Changli Gao <xiaosuo@...il.com>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] fs: optimize mpage_readpage()

On Sat, May 29, 2010 at 8:10 PM, Borislav Petkov <bp@...en8.de> wrote:
> From: Changli Gao <xiaosuo@...il.com>
> Date: Sat, May 29, 2010 at 09:18:46AM +0800
>
>> optimize mpage_readpage()
>>
>> we don't need to initialize bio, and pass it to do_mpage_readpage() as
>> parameter, as it is returned by do_mpage_readpage().
>>
>> Signed-off-by: Changli Gao <xiaosuo@...il.com>
>> ----
>>  fs/mpage.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> diff --git a/fs/mpage.c b/fs/mpage.c
>> index fd56ca2..94ff0d1 100644
>> --- a/fs/mpage.c
>> +++ b/fs/mpage.c
>> @@ -409,14 +409,14 @@ EXPORT_SYMBOL(mpage_readpages);
>>   */
>>  int mpage_readpage(struct page *page, get_block_t get_block)
>>  {
>> -     struct bio *bio = NULL;
>> +     struct bio *bio;
>>       sector_t last_block_in_bio = 0;
>>       struct buffer_head map_bh;
>>       unsigned long first_logical_block = 0;
>>
>>       map_bh.b_state = 0;
>>       map_bh.b_size = 0;
>> -     bio = do_mpage_readpage(bio, page, 1, &last_block_in_bio,
>> +     bio = do_mpage_readpage(NULL, page, 1, &last_block_in_bio,
>>                       &map_bh, &first_logical_block, get_block);
>>       if (bio)
>>               mpage_bio_submit(READ, bio);
>
> Nope, I don't think that's a good idea.
>
> On the one hand, this is a trick to shut up gcc:
>
> fs/mpage.c: In function ‘mpage_readpage’:
> fs/mpage.c:419: warning: ‘bio’ is used uninitialized in this function
>
> and, on the other hand, make sure bio is NULL and not some random stack
> value since bio is explicitly checked for NULL in do_mpage_readpage().
>

Did the compiler warning appear after applying my patch? It doesn't
happen when I testing it.  And I don't pass bio to
do_mpage_readpage(), but I pass NULL instead.

-- 
Regards,
Changli Gao(xiaosuo@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists