All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Yan Zheng <zheng.yan@oracle.com>, Josef Bacik <josef@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	Chris Mason <chris.mason@oracle.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch 11/11] btrfs: The file argument for fsync() is never null
Date: Sat, 29 May 2010 11:49:07 +0200	[thread overview]
Message-ID: <20100529094907.GL5483@bicker> (raw)

The "file" argument for fsync is never null so we can remove this check.

What drew my attention here is that 7ea8085910e: "drop unused dentry 
argument to ->fsync" introduced an unconditional dereference at the
start of the function and that generated a smatch warning.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 787b50a..e252d23 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1140,7 +1140,7 @@ int btrfs_sync_file(struct file *file, int datasync)
 	/*
 	 * ok we haven't committed the transaction yet, lets do a commit
 	 */
-	if (file && file->private_data)
+	if (file->private_data)
 		btrfs_ioctl_trans_end(file);
 
 	trans = btrfs_start_transaction(root, 0);

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Yan Zheng <zheng.yan@oracle.com>, Josef Bacik <josef@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	Chris Mason <chris.mason@oracle.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch 11/11] btrfs: The file argument for fsync() is never null
Date: Sat, 29 May 2010 09:49:07 +0000	[thread overview]
Message-ID: <20100529094907.GL5483@bicker> (raw)

The "file" argument for fsync is never null so we can remove this check.

What drew my attention here is that 7ea8085910e: "drop unused dentry 
argument to ->fsync" introduced an unconditional dereference at the
start of the function and that generated a smatch warning.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 787b50a..e252d23 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1140,7 +1140,7 @@ int btrfs_sync_file(struct file *file, int datasync)
 	/*
 	 * ok we haven't committed the transaction yet, lets do a commit
 	 */
-	if (file && file->private_data)
+	if (file->private_data)
 		btrfs_ioctl_trans_end(file);
 
 	trans = btrfs_start_transaction(root, 0);

             reply	other threads:[~2010-05-29  9:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-29  9:49 Dan Carpenter [this message]
2010-05-29  9:49 ` [patch 11/11] btrfs: The file argument for fsync() is never null Dan Carpenter
2010-06-14 20:07 ` Johannes Hirte
2010-06-14 20:07   ` Johannes Hirte
2010-06-14 20:49   ` Dan Carpenter
2010-06-14 20:49     ` [patch 11/11] btrfs: The file argument for fsync() is never Dan Carpenter
2010-06-14 20:58   ` [patch 11/11] btrfs: The file argument for fsync() is never null Christoph Hellwig
2010-06-14 20:58     ` Christoph Hellwig
2010-06-14 21:11     ` Dan Carpenter
2010-06-14 21:11       ` [patch 11/11] btrfs: The file argument for fsync() is never Dan Carpenter
2010-06-14 21:16       ` [patch 11/11] btrfs: The file argument for fsync() is never null Christoph Hellwig
2010-06-14 21:16         ` Christoph Hellwig
2010-06-14 21:45         ` Johannes Hirte
2010-06-14 21:45           ` Johannes Hirte
2010-06-15  0:08           ` Chris Mason
2010-06-15  0:08             ` [patch 11/11] btrfs: The file argument for fsync() is never Chris Mason
2010-06-16 18:04             ` [patch 11/11] btrfs: The file argument for fsync() is never null Johannes Hirte
2010-06-16 18:04               ` Johannes Hirte

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=20100529094907.GL5483@bicker \
    --to=error27@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=hch@lst.de \
    --cc=josef@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zheng.yan@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.