public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	viro@ZenIV.linux.org.uk, akpm@linux-foundation.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 2/4] vfs: filp is never NULL in do_generic_file_read()
Date: Thu, 31 Jul 2008 15:30:23 +0800	[thread overview]
Message-ID: <48916A0F.1000500@cn.fujitsu.com> (raw)
In-Reply-To: <20080731161554.3C84.KOSAKI.MOTOHIRO@jp.fujitsu.com>

KOSAKI Motohiro wrote:
>>  	*ppos = ((loff_t)index << PAGE_CACHE_SHIFT) + offset;
>> -	if (filp)
>> -		file_accessed(filp);
>> +	file_accessed(filp);
>>  }
>>  
>>  int file_read_actor(read_descriptor_t *desc, struct page *page,
> 
> if filp is never NULL, BUG_ON is better?
> 

static inline void file_accessed(struct file *file)
{
	if (!(file->f_flags & O_NOATIME))
		...
}

So if filp is NULL, we'll get a noisy NULL dereference bug immediately,
so BUG_ON() is not needed.



  reply	other threads:[~2008-07-31  7:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 13:08 [patch 0/4] vfs: trivial cleanups Miklos Szeredi
2008-07-30 13:08 ` [patch 1/4] splice: fix comment Miklos Szeredi
2008-07-30 13:08 ` [patch 2/4] vfs: filp is never NULL in do_generic_file_read() Miklos Szeredi
2008-07-31  7:19   ` KOSAKI Motohiro
2008-07-31  7:30     ` Li Zefan [this message]
2008-07-30 13:08 ` [patch 3/4] vfs: remove unused nameidata argument of may_create() Miklos Szeredi
2008-07-30 13:08 ` [patch 4/4] vfs: create file_truncate() helper Miklos Szeredi

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=48916A0F.1000500@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=viro@ZenIV.linux.org.uk \
    /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