[nfs:testing 57/58] fs/nfs/callback_proc.c:44:24: warning: passing argument 1 of 'PTR_ERR' makes pointer from integer without a cast

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git testing
head:   1ccf10857d962822e7447f5c0c891b3172817683
commit: 9c92cbfac3614a8b5ba5f735d1b3617a7e30e16b [57/58] NFSv4: Return NFS4ERR_DELAY when a delegation recall fails due to igrab()
config: x86_64-randconfig-x015-201822 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        git checkout 9c92cbfac3614a8b5ba5f735d1b3617a7e30e16b
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   fs/nfs/callback_proc.c: In function 'nfs4_callback_getattr':
>> fs/nfs/callback_proc.c:44:24: warning: passing argument 1 of 'PTR_ERR' makes pointer from integer without a cast [-Wint-conversion]
      if (inode == PTR_ERR(-EAGAIN))
                           ^
   In file included from arch/x86/include/asm/processor.h:32:0,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from include/linux/uio.h:13,
                    from include/linux/socket.h:8,
                    from include/uapi/linux/in.h:24,
                    from include/linux/in.h:23,
                    from include/linux/nfs_fs.h:22,
                    from fs/nfs/callback_proc.c:10:
   include/linux/err.h:29:33: note: expected 'const void *' but argument is of type 'int'
    static inline long __must_check PTR_ERR(__force const void *ptr)
                                    ^~~~~~~
>> fs/nfs/callback_proc.c:44:13: warning: comparison between pointer and integer
      if (inode == PTR_ERR(-EAGAIN))
                ^~
   fs/nfs/callback_proc.c: In function 'nfs4_callback_recall':
   fs/nfs/callback_proc.c:92:24: warning: passing argument 1 of 'PTR_ERR' makes pointer from integer without a cast [-Wint-conversion]
      if (inode == PTR_ERR(-EAGAIN))
                           ^
   In file included from arch/x86/include/asm/processor.h:32:0,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from include/linux/uio.h:13,
                    from include/linux/socket.h:8,
                    from include/uapi/linux/in.h:24,
                    from include/linux/in.h:23,
                    from include/linux/nfs_fs.h:22,
                    from fs/nfs/callback_proc.c:10:
   include/linux/err.h:29:33: note: expected 'const void *' but argument is of type 'int'
    static inline long __must_check PTR_ERR(__force const void *ptr)
                                    ^~~~~~~
   fs/nfs/callback_proc.c:92:13: warning: comparison between pointer and integer
      if (inode == PTR_ERR(-EAGAIN))
                ^~

vim +/PTR_ERR +44 fs/nfs/callback_proc.c

  > 10	#include <linux/nfs_fs.h>
    11	#include <linux/slab.h>
    12	#include <linux/rcupdate.h>
    13	#include "nfs4_fs.h"
    14	#include "callback.h"
    15	#include "delegation.h"
    16	#include "internal.h"
    17	#include "pnfs.h"
    18	#include "nfs4session.h"
    19	#include "nfs4trace.h"
    20	
    21	#define NFSDBG_FACILITY NFSDBG_CALLBACK
    22	
    23	__be32 nfs4_callback_getattr(void *argp, void *resp,
    24				     struct cb_process_state *cps)
    25	{
    26		struct cb_getattrargs *args = argp;
    27		struct cb_getattrres *res = resp;
    28		struct nfs_delegation *delegation;
    29		struct nfs_inode *nfsi;
    30		struct inode *inode;
    31	
    32		res->status = htonl(NFS4ERR_OP_NOT_IN_SESSION);
    33		if (!cps->clp) /* Always set for v4.0. Set in cb_sequence for v4.1 */
    34			goto out;
    35	
    36		res->bitmap[0] = res->bitmap[1] = 0;
    37		res->status = htonl(NFS4ERR_BADHANDLE);
    38	
    39		dprintk_rcu("NFS: GETATTR callback request from %s\n",
    40			rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR));
    41	
    42		inode = nfs_delegation_find_inode(cps->clp, &args->fh);
    43		if (IS_ERR(inode)) {
  > 44			if (inode == PTR_ERR(-EAGAIN))
    45				res->status = htonl(NFS4ERR_DELAY);
    46			trace_nfs4_cb_getattr(cps->clp, &args->fh, NULL,
    47					-ntohl(res->status));
    48			goto out;
    49		}
    50		nfsi = NFS_I(inode);
    51		rcu_read_lock();
    52		delegation = rcu_dereference(nfsi->delegation);
    53		if (delegation == NULL || (delegation->type & FMODE_WRITE) == 0)
    54			goto out_iput;
    55		res->size = i_size_read(inode);
    56		res->change_attr = delegation->change_attr;
    57		if (nfs_have_writebacks(inode))
    58			res->change_attr++;
    59		res->ctime = inode->i_ctime;
    60		res->mtime = inode->i_mtime;
    61		res->bitmap[0] = (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) &
    62			args->bitmap[0];
    63		res->bitmap[1] = (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) &
    64			args->bitmap[1];
    65		res->status = 0;
    66	out_iput:
    67		rcu_read_unlock();
    68		trace_nfs4_cb_getattr(cps->clp, &args->fh, inode, -ntohl(res->status));
    69		iput(inode);
    70	out:
    71		dprintk("%s: exit with status = %d\n", __func__, ntohl(res->status));
    72		return res->status;
    73	}
    74	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux