public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jlayton@kernel.org, NeilBrown <neilb@suse.com>
Cc: linux-nfs@vger.kernel.org
Subject: [bug report] nfs: make sillyrename an async operation
Date: Wed, 19 Dec 2018 13:33:29 +0300	[thread overview]
Message-ID: <20181219103329.GA28137@kadam> (raw)

[ Ancient code.  But NeilB changed get_cred() recently so Smatch thinks
  it understands it now.  - dan ]

Hello Jeff Layton,

The patch d3d4152a5d59: "nfs: make sillyrename an async operation"
from Sep 17, 2010, leads to the following static checker warning:

	fs/nfs/unlink.c:351 nfs_async_rename()
	warn: 'data->cred' isn't an ERR_PTR

fs/nfs/unlink.c
   330  struct rpc_task *
   331  nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
   332                   struct dentry *old_dentry, struct dentry *new_dentry,
   333                   void (*complete)(struct rpc_task *, struct nfs_renamedata *))
   334  {
   335          struct nfs_renamedata *data;
   336          struct rpc_message msg = { };
   337          struct rpc_task_setup task_setup_data = {
   338                  .rpc_message = &msg,
   339                  .callback_ops = &nfs_rename_ops,
   340                  .workqueue = nfsiod_workqueue,
   341                  .rpc_client = NFS_CLIENT(old_dir),
   342                  .flags = RPC_TASK_ASYNC,
   343          };
   344  
   345          data = kzalloc(sizeof(*data), GFP_KERNEL);
   346          if (data == NULL)
   347                  return ERR_PTR(-ENOMEM);
   348          task_setup_data.callback_data = data;
   349  
   350          data->cred = get_current_cred();
   351          if (IS_ERR(data->cred)) {

get_current_cred() always returns a valid pointer, I think?  Can we
just remove this condition?

   352                  struct rpc_task *task = ERR_CAST(data->cred);
   353                  kfree(data);
   354                  return task;
   355          }

regards,
dan carpenter

             reply	other threads:[~2018-12-19 10:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-19 10:33 Dan Carpenter [this message]
2018-12-19 23:31 ` [bug report] nfs: make sillyrename an async operation NeilBrown

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=20181219103329.GA28137@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox