All of lore.kernel.org
 help / color / mirror / Atom feed
* re: locks: don't allocate a lock context for an F_UNLCK request
@ 2015-03-10 20:10 Dan Carpenter
  2015-03-10 20:13 ` Jeff Layton
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-03-10 20:10 UTC (permalink / raw)
  To: jeff.layton; +Cc: linux-fsdevel

Hello Jeff Layton,

The patch 7af81f664280: "locks: don't allocate a lock context for an
F_UNLCK request" from Feb 26, 2015, leads to the following static
checker warning:

	fs/locks.c:1613 generic_add_lease()
	warn: comparison is always 'false'

fs/locks.c
  1597  static int
  1598  generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv)
  1599  {
  1600          struct file_lock *fl, *my_fl = NULL, *lease;
  1601          struct dentry *dentry = filp->f_path.dentry;
  1602          struct inode *inode = dentry->d_inode;
  1603          struct file_lock_context *ctx;
  1604          bool is_deleg = (*flp)->fl_flags & FL_DELEG;
  1605          int error;
  1606          LIST_HEAD(dispose);
  1607  
  1608          lease = *flp;
  1609          trace_generic_add_lease(inode, lease);
  1610  
  1611          ctx = locks_get_lock_context(inode, arg);
  1612          if (!ctx)
  1613                  return (arg == F_UNLCK) ? 0 : -ENOMEM;
                                ^^^^^^^^^^^^^^
This will never be true.  It's harmless, but I'm not sure it is
intentional.

  1614  

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: locks: don't allocate a lock context for an F_UNLCK request
  2015-03-10 20:10 locks: don't allocate a lock context for an F_UNLCK request Dan Carpenter
@ 2015-03-10 20:13 ` Jeff Layton
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2015-03-10 20:13 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-fsdevel

On Tue, 10 Mar 2015 23:10:50 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> Hello Jeff Layton,
> 
> The patch 7af81f664280: "locks: don't allocate a lock context for an
> F_UNLCK request" from Feb 26, 2015, leads to the following static
> checker warning:
> 
> 	fs/locks.c:1613 generic_add_lease()
> 	warn: comparison is always 'false'
> 
> fs/locks.c
>   1597  static int
>   1598  generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv)
>   1599  {
>   1600          struct file_lock *fl, *my_fl = NULL, *lease;
>   1601          struct dentry *dentry = filp->f_path.dentry;
>   1602          struct inode *inode = dentry->d_inode;
>   1603          struct file_lock_context *ctx;
>   1604          bool is_deleg = (*flp)->fl_flags & FL_DELEG;
>   1605          int error;
>   1606          LIST_HEAD(dispose);
>   1607  
>   1608          lease = *flp;
>   1609          trace_generic_add_lease(inode, lease);
>   1610  
>   1611          ctx = locks_get_lock_context(inode, arg);
>   1612          if (!ctx)
>   1613                  return (arg == F_UNLCK) ? 0 : -ENOMEM;
>                                 ^^^^^^^^^^^^^^
> This will never be true.  It's harmless, but I'm not sure it is
> intentional.
> 

Doh -- that's quite right. I'll take that bit out.

Thanks!
-- 
Jeff Layton <jlayton@primarydata.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-10 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10 20:10 locks: don't allocate a lock context for an F_UNLCK request Dan Carpenter
2015-03-10 20:13 ` Jeff Layton

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.