[cifs:for-next 6/6] fs/cifs/smb2misc.c:437:4: note: in expansion of macro 'cifs_dbg'

kbuild test robot lkp at intel.com
Sun May 6 18:22:02 UTC 2018


tree:   git://git.samba.org/sfrench/cifs-2.6.git for-next
head:   94fb5e2a30ddef974f3d52a75908a9ee0c6aaf53
commit: 94fb5e2a30ddef974f3d52a75908a9ee0c6aaf53 [6/6] cifs: update calc_size to take a server argument
config: i386-randconfig-x013-201818 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        git checkout 94fb5e2a30ddef974f3d52a75908a9ee0c6aaf53
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:14:0,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/hardirq.h:5,
                    from include/net/sock.h:43,
                    from fs/cifs/smb2pdu.h:27,
                    from fs/cifs/smb2misc.c:24:
   fs/cifs/smb2misc.c: In function 'smb2_calc_size':
   include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/printk.h:136:10: note: in definition of macro 'no_printk'
      printk(fmt, ##__VA_ARGS__);  \
             ^~~
   include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
    #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                       ^~~~~~~~
   include/linux/printk.h:410:12: note: in expansion of macro 'KERN_DEBUG'
     no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
               ^~~~~~~~~~
   fs/cifs/cifs_debug.h:54:3: note: in expansion of macro 'pr_debug_once'
      pr_debug_ ## ratefunc("%s: "   \
      ^~~~~~~~~
   fs/cifs/cifs_debug.h:67:3: note: in expansion of macro 'cifs_dbg_func'
      cifs_dbg_func(once,   \
      ^~~~~~~~~~~~~
>> fs/cifs/smb2misc.c:437:4: note: in expansion of macro 'cifs_dbg'
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
       ^~~~~~~~
   fs/cifs/smb2misc.c:437:38: note: format string is defined here
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
                                       ~~^
                                       %u
   In file included from include/linux/kernel.h:14:0,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/hardirq.h:5,
                    from include/net/sock.h:43,
                    from fs/cifs/smb2pdu.h:27,
                    from fs/cifs/smb2misc.c:24:
   include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/printk.h:357:10: note: in definition of macro 'printk_once'
      printk(fmt, ##__VA_ARGS__);   \
             ^~~
   include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:386:14: note: in expansion of macro 'KERN_ERR'
     printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                 ^~~~~~~~
   fs/cifs/cifs_debug.h:57:3: note: in expansion of macro 'pr_err_once'
      pr_err_ ## ratefunc("CIFS VFS: "  \
      ^~~~~~~
   fs/cifs/cifs_debug.h:67:3: note: in expansion of macro 'cifs_dbg_func'
      cifs_dbg_func(once,   \
      ^~~~~~~~~~~~~
>> fs/cifs/smb2misc.c:437:4: note: in expansion of macro 'cifs_dbg'
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
       ^~~~~~~~
   fs/cifs/smb2misc.c:437:38: note: format string is defined here
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
                                       ~~^
                                       %u
   In file included from include/linux/kernel.h:14:0,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/hardirq.h:5,
                    from include/net/sock.h:43,
                    from fs/cifs/smb2pdu.h:27,
                    from fs/cifs/smb2misc.c:24:
   include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/printk.h:136:10: note: in definition of macro 'no_printk'
      printk(fmt, ##__VA_ARGS__);  \
             ^~~
   include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
    #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                       ^~~~~~~~
   include/linux/printk.h:410:12: note: in expansion of macro 'KERN_DEBUG'
     no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
               ^~~~~~~~~~
   fs/cifs/cifs_debug.h:60:3: note: in expansion of macro 'pr_debug_once'
      pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__); \
      ^~~~~~~~~
   fs/cifs/cifs_debug.h:67:3: note: in expansion of macro 'cifs_dbg_func'
      cifs_dbg_func(once,   \
      ^~~~~~~~~~~~~
>> fs/cifs/smb2misc.c:437:4: note: in expansion of macro 'cifs_dbg'
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
       ^~~~~~~~
   fs/cifs/smb2misc.c:437:38: note: format string is defined here
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
                                       ~~^
                                       %u
   In file included from include/linux/kernel.h:14:0,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/hardirq.h:5,
                    from include/net/sock.h:43,
                    from fs/cifs/smb2pdu.h:27,
                    from fs/cifs/smb2misc.c:24:
   fs/cifs/cifs_debug.h:54:25: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
      pr_debug_ ## ratefunc("%s: "   \
                            ^
   include/linux/printk.h:288:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   fs/cifs/cifs_debug.h:54:3: note: in expansion of macro 'pr_debug_ratelimited'
      pr_debug_ ## ratefunc("%s: "   \
      ^~~~~~~~~
   fs/cifs/cifs_debug.h:70:3: note: in expansion of macro 'cifs_dbg_func'
      cifs_dbg_func(ratelimited,  \
      ^~~~~~~~~~~~~
>> fs/cifs/smb2misc.c:437:4: note: in expansion of macro 'cifs_dbg'
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
       ^~~~~~~~
   fs/cifs/smb2misc.c:437:38: note: format string is defined here
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
                                       ~~^
                                       %u
   In file included from include/linux/kernel.h:14:0,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/hardirq.h:5,
                    from include/net/sock.h:43,
                    from fs/cifs/smb2pdu.h:27,
                    from fs/cifs/smb2misc.c:24:
   include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/printk.h:425:10: note: in definition of macro 'printk_ratelimited'
      printk(fmt, ##__VA_ARGS__);    \
             ^~~
   include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:439:21: note: in expansion of macro 'KERN_ERR'
     printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                        ^~~~~~~~
   fs/cifs/cifs_debug.h:57:3: note: in expansion of macro 'pr_err_ratelimited'
      pr_err_ ## ratefunc("CIFS VFS: "  \
      ^~~~~~~
   fs/cifs/cifs_debug.h:70:3: note: in expansion of macro 'cifs_dbg_func'
      cifs_dbg_func(ratelimited,  \
      ^~~~~~~~~~~~~
>> fs/cifs/smb2misc.c:437:4: note: in expansion of macro 'cifs_dbg'
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
       ^~~~~~~~
   fs/cifs/smb2misc.c:437:38: note: format string is defined here
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
                                       ~~^
                                       %u
   In file included from include/linux/kernel.h:14:0,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/hardirq.h:5,
                    from include/net/sock.h:43,
                    from fs/cifs/smb2pdu.h:27,
                    from fs/cifs/smb2misc.c:24:
>> fs/cifs/smb2misc.c:437:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
                     ^
   include/linux/printk.h:288:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   fs/cifs/cifs_debug.h:60:3: note: in expansion of macro 'pr_debug_ratelimited'
      pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__); \
      ^~~~~~~~~
   fs/cifs/cifs_debug.h:70:3: note: in expansion of macro 'cifs_dbg_func'
      cifs_dbg_func(ratelimited,  \
      ^~~~~~~~~~~~~
>> fs/cifs/smb2misc.c:437:4: note: in expansion of macro 'cifs_dbg'
       cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
       ^~~~~~~~
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
   Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:set_bit
   Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:clear_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
   Cyclomatic Complexity 4 include/linux/string.h:memcpy
   Cyclomatic Complexity 4 include/linux/string.h:memcmp
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_inc
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_inc
   Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_sub
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock
   Cyclomatic Complexity 1 include/linux/workqueue.h:__init_work
   Cyclomatic Complexity 1 include/linux/kasan.h:kasan_kmalloc
   Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 1 include/linux/slab.h:kmem_cache_alloc_trace
   Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_order_trace
   Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/dcache.h:d_inode
   Cyclomatic Complexity 1 fs/cifs/cifsglob.h:tlink_tcon
   Cyclomatic Complexity 1 fs/cifs/smb2glob.h:get_sync_hdr
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 3 fs/cifs/cifsglob.h:cifs_get_tlink
   Cyclomatic Complexity 11 fs/cifs/smb2misc.c:check_smb2_hdr
   Cyclomatic Complexity 1 fs/cifs/cifsglob.h:get_rfc1002_length
   Cyclomatic Complexity 2 arch/x86/include/asm/qspinlock.h:native_queued_spin_unlock
   Cyclomatic Complexity 1 arch/x86/include/asm/qspinlock.h:queued_spin_unlock
   Cyclomatic Complexity 1 include/linux/spinlock.h:do_raw_spin_unlock
   Cyclomatic Complexity 1 include/linux/spinlock_api_smp.h:__raw_spin_unlock
   Cyclomatic Complexity 5 fs/cifs/smb2misc.c:cifs_ses_oplock_break
   Cyclomatic Complexity 2 fs/cifs/cifsglob.h:CIFS_I
   Cyclomatic Complexity 1 include/linux/workqueue.h:queue_work
   Cyclomatic Complexity 22 fs/cifs/smb2misc.c:smb2_tcon_has_lease
   Cyclomatic Complexity 15 fs/cifs/smb2misc.c:smb2_is_valid_lease_break
   Cyclomatic Complexity 3 fs/cifs/smb2misc.c:smb2_cancelled_close_fid
   Cyclomatic Complexity 21 fs/cifs/smb2misc.c:smb2_get_data_area_len
   Cyclomatic Complexity 11 fs/cifs/smb2misc.c:smb2_calc_size
   Cyclomatic Complexity 44 fs/cifs/smb2misc.c:smb2_check_message
   Cyclomatic Complexity 4 fs/cifs/smb2misc.c:cifs_convert_path_to_utf16
   Cyclomatic Complexity 4 fs/cifs/smb2misc.c:smb2_get_lease_state
   Cyclomatic Complexity 30 fs/cifs/smb2misc.c:smb2_is_valid_oplock_break
   Cyclomatic Complexity 5 fs/cifs/smb2misc.c:smb2_handle_cancelled_mid

vim +/cifs_dbg +437 fs/cifs/smb2misc.c

   400	
   401	/*
   402	 * Calculate the size of the SMB message based on the fixed header
   403	 * portion, the number of word parameters and the data portion of the message.
   404	 */
   405	unsigned int
   406	smb2_calc_size(void *buf, struct TCP_Server_Info *srvr)
   407	{
   408		struct smb2_pdu *pdu = (struct smb2_pdu *)buf;
   409		struct smb2_hdr *hdr = &pdu->hdr;
   410		struct smb2_sync_hdr *shdr = get_sync_hdr(hdr);
   411		int offset; /* the offset from the beginning of SMB to data area */
   412		int data_length; /* the length of the variable length data area */
   413		/* Structure Size has already been checked to make sure it is 64 */
   414		int len = srvr->vals->header_preamble_size + le16_to_cpu(shdr->StructureSize);
   415	
   416		/*
   417		 * StructureSize2, ie length of fixed parameter area has already
   418		 * been checked to make sure it is the correct length.
   419		 */
   420		len += le16_to_cpu(pdu->StructureSize2);
   421	
   422		if (has_smb2_data_area[le16_to_cpu(shdr->Command)] == false)
   423			goto calc_size_exit;
   424	
   425		smb2_get_data_area_len(&offset, &data_length, hdr);
   426		cifs_dbg(FYI, "SMB2 data length %d offset %d\n", data_length, offset);
   427	
   428		if (data_length > 0) {
   429			/*
   430			 * Check to make sure that data area begins after fixed area,
   431			 * Note that last byte of the fixed area is part of data area
   432			 * for some commands, typically those with odd StructureSize,
   433			 * so we must add one to the calculation (and 4 to account for
   434			 * the size of the RFC1001 hdr.
   435			 */
   436			if (offset + srvr->vals->header_preamble_size + 1 < len) {
 > 437				cifs_dbg(VFS, "data area offset %lu overlaps SMB2 header %d\n",
   438					 offset + srvr->vals->header_preamble_size + 1, len);
   439				data_length = 0;
   440			} else {
   441				len = srvr->vals->header_preamble_size + offset + data_length;
   442			}
   443		}
   444	calc_size_exit:
   445		cifs_dbg(FYI, "SMB2 len %d\n", len);
   446		return len;
   447	}
   448	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 27621 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180507/f49f4c6d/config.gz>


More information about the samba-technical mailing list