[ceph-client:tls_logger 3/5] net/ceph/ceph_san.c:29:34: warning: suggest parentheses around '+' in operand of '&'

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

 



tree:   https://github.com/ceph/ceph-client.git tls_logger
head:   b980c3ea5fcc54aa543fd5e96212b7fb892d42a5
commit: 764e50ba296da76e7332d2d08223d3e484aea2b3 [3/5] tls: adding an allocation histogram
config: arc-randconfig-001-20250302 (https://download.01.org/0day-ci/archive/20250302/202503020506.Qrxa9ubO-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503020506.Qrxa9ubO-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/202503020506.Qrxa9ubO-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   net/ceph/ceph_san.c: In function 'log_cephsan':
>> net/ceph/ceph_san.c:29:34: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
      29 |     int head_idx = tls->head_idx + 1 & (CEPH_SAN_MAX_LOGS - 1);
         |                    ~~~~~~~~~~~~~~^~~


vim +29 net/ceph/ceph_san.c

    15	
    16	
    17	static inline void *cephsan_pagefrag_get_ptr(struct cephsan_pagefrag *pf, u64 val);
    18	/* The definitions for struct ceph_san_log_entry and struct ceph_san_tls_logger
    19	 * have been moved to cephsan.h (under CONFIG_DEBUG_FS) to avoid duplication.
    20	 */
    21	
    22	void log_cephsan(char *buf) {
    23	    /* Use the per-core TLS logger */
    24	    u64 buf_idx;
    25	    int len = strlen(buf);
    26	    struct ceph_san_tls_logger *tls = this_cpu_ptr(&ceph_san_tls);
    27	    struct cephsan_pagefrag *pf = this_cpu_ptr(&ceph_san_pagefrag);
    28	
  > 29	    int head_idx = tls->head_idx + 1 & (CEPH_SAN_MAX_LOGS - 1);
    30	    int pre_len = tls->logs[head_idx].len;
    31	
    32	    buf[len-1] = '\0';
    33	    tls->logs[head_idx].pid = current->pid;
    34	    tls->logs[head_idx].ts = jiffies;
    35	    memcpy(tls->logs[head_idx].comm, current->comm, TASK_COMM_LEN);
    36	
    37	    cephsan_pagefrag_free(pf, pre_len);
    38	    tls->logs[head_idx].len = 0;
    39	
    40	    buf_idx = cephsan_pagefrag_alloc(pf, len);
    41	    if (buf_idx) {
    42			tls->head_idx = head_idx;
    43			tls->histogram.counters[len >> 3]++;
    44			tls->logs[head_idx].len = len;
    45	        tls->logs[head_idx].buf = cephsan_pagefrag_get_ptr(pf, buf_idx);
    46			memcpy(tls->logs[head_idx].buf, buf, len);
    47	    }
    48	}
    49	EXPORT_SYMBOL(log_cephsan);
    50	

-- 
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