From: kernel test robot <lkp@intel.com>
To: Alex Markuze <amarkuze@redhat.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
ceph-devel@vger.kernel.org
Subject: [ceph-client:tls_logger 12/19] net/ceph/ceph_san_pagefrag.c:107: warning: Excess function parameter 'n' description in 'cephsan_pagefrag_get_ptr_from_tail'
Date: Tue, 18 Mar 2025 18:30:29 +0800 [thread overview]
Message-ID: <202503181819.sMIZbyRn-lkp@intel.com> (raw)
tree: https://github.com/ceph/ceph-client.git tls_logger
head: 75b56e556ea415e29a13a8b7e98d302fbbec4c01
commit: b756c73bb29c0acb3b2509081debd5dc20045242 [12/19] fixup buffer allocation
config: i386-buildonly-randconfig-001-20250318 (https://download.01.org/0day-ci/archive/20250318/202503181819.sMIZbyRn-lkp@intel.com/config)
compiler: clang version 20.1.0 (https://github.com/llvm/llvm-project 24a30daaa559829ad079f2ff7f73eb4e18095f88)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250318/202503181819.sMIZbyRn-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503181819.sMIZbyRn-lkp@intel.com/
All warnings (new ones prefixed by >>):
net/ceph/ceph_san_pagefrag.c:14: warning: Function parameter or struct member 'pf' not described in 'cephsan_pagefrag_init'
net/ceph/ceph_san_pagefrag.c:54: warning: Function parameter or struct member 'pf' not described in 'cephsan_pagefrag_alloc'
>> net/ceph/ceph_san_pagefrag.c:107: warning: Excess function parameter 'n' description in 'cephsan_pagefrag_get_ptr_from_tail'
net/ceph/ceph_san_pagefrag.c:119: warning: Function parameter or struct member 'pf' not described in 'cephsan_pagefrag_free'
net/ceph/ceph_san_pagefrag.c:130: warning: Function parameter or struct member 'pf' not described in 'cephsan_pagefrag_deinit'
>> net/ceph/ceph_san_pagefrag.c:147: warning: Function parameter or struct member 'pf' not described in 'cephsan_pagefrag_reset'
vim +107 net/ceph/ceph_san_pagefrag.c
5
6 /**
7 * cephsan_pagefrag_init - Initialize the pagefrag allocator.
8 *
9 * Allocates a 4MB contiguous buffer and resets head and tail pointers.
10 *
11 * Return: 0 on success, negative error code on failure.
12 */
13 int cephsan_pagefrag_init(struct cephsan_pagefrag *pf)
> 14 {
15 pf->pages = alloc_pages(GFP_KERNEL, get_order(CEPHSAN_PAGEFRAG_SIZE));
16 if (!pf->pages)
17 return -ENOMEM;
18
19 pf->buffer = page_address(pf->pages);
20 pf->head = 0;
21 pf->tail = 0;
22 return 0;
23 }
24 EXPORT_SYMBOL(cephsan_pagefrag_init);
25
26 /**
27 * cephsan_pagefrag_init_with_buffer - Initialize pagefrag with an existing buffer
28 * @pf: pagefrag allocator to initialize
29 * @buffer: pre-allocated buffer to use
30 * @size: size of the buffer
31 *
32 * Return: 0 on success
33 */
34 int cephsan_pagefrag_init_with_buffer(struct cephsan_pagefrag *pf, void *buffer, size_t size)
35 {
36 pf->pages = NULL; /* No pages allocated, using provided buffer */
37 pf->buffer = buffer;
38 pf->head = 0;
39 pf->tail = 0;
40 return 0;
41 }
42 EXPORT_SYMBOL(cephsan_pagefrag_init_with_buffer);
43
44 /**
45 * cephsan_pagefrag_alloc - Allocate bytes from the pagefrag buffer.
46 * @n: number of bytes to allocate.
47 *
48 * Allocates @n bytes if there is sufficient free space in the buffer.
49 * Advances the head pointer by @n bytes (wrapping around if needed).
50 *
51 * Return: pointer to the allocated memory, or NULL if not enough space.
52 */
53 u64 cephsan_pagefrag_alloc(struct cephsan_pagefrag *pf, unsigned int n)
54 {
55 /* Case 1: tail > head */
56 if (pf->tail > pf->head) {
57 if (pf->tail - pf->head > n) {
58 unsigned int prev_head = pf->head;
59 pf->head += n;
60 return ((u64)n << 32) | prev_head;
61 } else {
62 return 0;
63 }
64 }
65 /* Case 2: tail <= head */
66 if (pf->head + n <= CEPHSAN_PAGEFRAG_SIZE) {
67 /* Normal allocation */
68 unsigned int prev_head = pf->head;
69 pf->head += n;
70 return ((u64)n << 32) | prev_head;
71 } else {
72 /* Need to wrap around */
73 if (n < pf->tail) {
74 pf->head = n;
75 n += CEPHSAN_PAGEFRAG_SIZE - pf->head;
76 return ((u64)n << 32) | 0;
77 } else {
78 return 0;
79 }
80 }
81 pr_err("impossible: Not enough space in pagefrag buffer\n");
82 return 0;
83 }
84 EXPORT_SYMBOL(cephsan_pagefrag_alloc);
85
86 /**
87 * cephsan_pagefrag_get_ptr - Get buffer pointer from pagefrag allocation result
88 * @pf: pagefrag allocator
89 * @val: return value from cephsan_pagefrag_alloc
90 *
91 * Return: pointer to allocated buffer region
92 */
93 void *cephsan_pagefrag_get_ptr(struct cephsan_pagefrag *pf, u64 val)
94 {
95 return pf->buffer + (val & 0xFFFFFFFF);
96 }
97 EXPORT_SYMBOL(cephsan_pagefrag_get_ptr);
98
99 /**
100 * cephsan_pagefrag_get_ptr_from_tail - Get buffer pointer from pagefrag tail
101 * @pf: pagefrag allocator
102 * @n: number of bytes to get pointer from
103 *
104 * Returns pointer to the buffer region at the tail pointer minus @n bytes.
105 */
106 void *cephsan_pagefrag_get_ptr_from_tail(struct cephsan_pagefrag *pf)
> 107 {
108 return pf->buffer + pf->tail;
109 }
110 EXPORT_SYMBOL(cephsan_pagefrag_get_ptr_from_tail);
111
112 /**
113 * cephsan_pagefrag_free - Free bytes in the pagefrag allocator.
114 * @n: number of bytes to free.
115 *
116 * Advances the tail pointer by @n bytes (wrapping around if needed).
117 */
118 void cephsan_pagefrag_free(struct cephsan_pagefrag *pf, unsigned int n)
119 {
120 pf->tail = (pf->tail + n) & (CEPHSAN_PAGEFRAG_SIZE - 1);
121 }
122 EXPORT_SYMBOL(cephsan_pagefrag_free);
123
124 /**
125 * cephsan_pagefrag_deinit - Deinitialize the pagefrag allocator.
126 *
127 * Frees the allocated buffer and resets the head and tail pointers.
128 */
129 void cephsan_pagefrag_deinit(struct cephsan_pagefrag *pf)
130 {
131 if (pf->pages) {
132 free_pages((unsigned long)pf->pages, get_order(CEPHSAN_PAGEFRAG_SIZE));
133 pf->pages = NULL;
134 }
135 /* Don't free buffer if it was provided externally */
136 pf->buffer = NULL;
137 pf->head = pf->tail = 0;
138 }
139 EXPORT_SYMBOL(cephsan_pagefrag_deinit);
140
141 /**
142 * cephsan_pagefrag_reset - Reset the pagefrag allocator.
143 *
144 * Resets the head and tail pointers to the beginning of the buffer.
145 */
146 void cephsan_pagefrag_reset(struct cephsan_pagefrag *pf)
> 147 {
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-03-18 10:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202503181819.sMIZbyRn-lkp@intel.com \
--to=lkp@intel.com \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox