[ceph-client:tls_logger 6/6] net/ceph/ceph_san.c:40:5: warning: this 'if' clause does not guard...

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

 



tree:   https://github.com/ceph/ceph-client.git tls_logger
head:   8bb4b4a8adc916ebe57638af949152b069d7b58a
commit: 8bb4b4a8adc916ebe57638af949152b069d7b58a [6/6] cephsan: bug fixes
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20250311/202503110127.na2HCVqj-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250311/202503110127.na2HCVqj-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503110127.na2HCVqj-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from include/asm-generic/bug.h:22,
                    from arch/x86/include/asm/bug.h:99,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/linux/spinlock.h:60,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/slab.h:16,
                    from net/ceph/ceph_san.c:1:
   net/ceph/ceph_san.c: In function 'ceph_san_tls_release':
>> include/linux/kern_levels.h:5:25: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
       5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
         |                         ^~~~~~
   include/linux/printk.h:473:25: note: in definition of macro 'printk_index_wrap'
     473 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ^~~~
   include/linux/printk.h:544:9: note: in expansion of macro 'printk'
     544 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~
   include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
      11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
         |                         ^~~~~~~~
   include/linux/printk.h:544:16: note: in expansion of macro 'KERN_ERR'
     544 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |                ^~~~~~~~
   net/ceph/ceph_san.c:41:13: note: in expansion of macro 'pr_err'
      41 |             pr_err("sig is wrong %p %llx != %llx", context, context->sig, CEPH_SAN_SIG);
         |             ^~~~~~
>> net/ceph/ceph_san.c:40:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
      40 |     if (context->sig != CEPH_SAN_SIG)
         |     ^~
   net/ceph/ceph_san.c:42:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
      42 |             return;
         |             ^~~~~~
   net/ceph/ceph_san.c: In function 'log_cephsan_tls':
   net/ceph/ceph_san.c:112:37: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
     112 |     int head_idx = logger->head_idx + 1 & (CEPH_SAN_MAX_LOGS - 1);
         |                    ~~~~~~~~~~~~~~~~~^~~
   net/ceph/ceph_san.c: In function 'log_cephsan_percore':
   net/ceph/ceph_san.c:155:33: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
     155 |     int head_idx = pc->head_idx + 1 & (CEPH_SAN_MAX_LOGS - 1);
         |                    ~~~~~~~~~~~~~^~~
--
   In file included from include/asm-generic/bug.h:22,
                    from arch/x86/include/asm/bug.h:99,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/linux/spinlock.h:60,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/slab.h:16,
                    from ceph_san.c:1:
   ceph_san.c: In function 'ceph_san_tls_release':
>> include/linux/kern_levels.h:5:25: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
       5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
         |                         ^~~~~~
   include/linux/printk.h:473:25: note: in definition of macro 'printk_index_wrap'
     473 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ^~~~
   include/linux/printk.h:544:9: note: in expansion of macro 'printk'
     544 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~
   include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
      11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
         |                         ^~~~~~~~
   include/linux/printk.h:544:16: note: in expansion of macro 'KERN_ERR'
     544 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |                ^~~~~~~~
   ceph_san.c:41:13: note: in expansion of macro 'pr_err'
      41 |             pr_err("sig is wrong %p %llx != %llx", context, context->sig, CEPH_SAN_SIG);
         |             ^~~~~~
   ceph_san.c:40:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
      40 |     if (context->sig != CEPH_SAN_SIG)
         |     ^~
   ceph_san.c:42:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
      42 |             return;
         |             ^~~~~~
   ceph_san.c: In function 'log_cephsan_tls':
   ceph_san.c:112:37: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
     112 |     int head_idx = logger->head_idx + 1 & (CEPH_SAN_MAX_LOGS - 1);
         |                    ~~~~~~~~~~~~~~~~~^~~
   ceph_san.c: In function 'log_cephsan_percore':
   ceph_san.c:155:33: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
     155 |     int head_idx = pc->head_idx + 1 & (CEPH_SAN_MAX_LOGS - 1);
         |                    ~~~~~~~~~~~~~^~~


vim +/if +40 net/ceph/ceph_san.c

    26	
    27	static inline void *cephsan_pagefrag_get_ptr(struct cephsan_pagefrag *pf, u64 val);
    28	/* The definitions for struct ceph_san_log_entry and struct ceph_san_tls_logger
    29	 * have been moved to cephsan.h (under CONFIG_DEBUG_FS) to avoid duplication.
    30	 */
    31	
    32	#define CEPH_SAN_SIG 0xDEADC0DE
    33	/* Release function for TLS storage */
    34	static void ceph_san_tls_release(void *ptr)
    35	{
    36	    struct tls_ceph_san_context *context = ptr;
    37	    if (!context)
    38	        return;
    39	
  > 40	    if (context->sig != CEPH_SAN_SIG)
  > 41		    pr_err("sig is wrong %p %llx != %llx", context, context->sig, CEPH_SAN_SIG);
    42		    return;
    43	
    44	    /* Remove from global list with lock protection */
    45	    spin_lock(&g_ceph_san_contexts_lock);
    46	    list_del(&context->list);
    47	    spin_unlock(&g_ceph_san_contexts_lock);
    48	
    49	    /* Free all log entries */
    50	        int head_idx = context->logger.head_idx & (CEPH_SAN_MAX_LOGS - 1);
    51	        int tail_idx = (head_idx + 1) & (CEPH_SAN_MAX_LOGS - 1);
    52	
    53	    for (int i = tail_idx; (i & (CEPH_SAN_MAX_LOGS - 1)) != head_idx; i++) {
    54	        struct ceph_san_log_entry_tls *entry = &context->logger.logs[i & (CEPH_SAN_MAX_LOGS - 1)];
    55	        if (entry->buf) {
    56	            if (entry->ts & 0x1)
    57	                    kmem_cache_free(ceph_san_log_256_cache, entry->buf);
    58				else
    59	                    kmem_cache_free(ceph_san_log_128_cache, entry->buf);
    60				entry->buf = NULL;
    61			}
    62		}
    63	
    64	    kmem_cache_free(ceph_san_tls_logger_cache, context);
    65	}
    66	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux