[kdave-btrfs-devel:ext/qu/subpage-compress 102/103] fs/btrfs/lzo.c:136:25: error: cast from pointer to integer of different size

From: kernel test robot
Date: Thu Sep 30 2021 - 18:33:03 EST


tree: https://github.com/kdave/btrfs-devel.git ext/qu/subpage-compress
head: 7565a7bad0aa85a48ab9009d629168f9b5578cdc
commit: b978264e0830f3e0585c20f7f155d3f61e8b7096 [102/103] debug
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/kdave/btrfs-devel/commit/b978264e0830f3e0585c20f7f155d3f61e8b7096
git remote add kdave-btrfs-devel https://github.com/kdave/btrfs-devel.git
git fetch --no-tags kdave-btrfs-devel ext/qu/subpage-compress
git checkout b978264e0830f3e0585c20f7f155d3f61e8b7096
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from include/linux/kernel.h:19,
from fs/btrfs/lzo.c:6:
fs/btrfs/lzo.c: In function 'copy_compressed_data_to_page':
>> fs/btrfs/lzo.c:136:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
136 | (u64)compressed_data, compressed_size, (u64)cur_out, sectorsize, *cur_out);
| ^
include/linux/printk.h:418:33: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
fs/btrfs/lzo.c:135:9: note: in expansion of macro 'printk'
135 | printk(KERN_DEBUG "DBG: compressed_data=0x%llx compressed_size=%lu cur_out=0x%llx sectorsize=%u cur_out=%u\n",
| ^~~~~~
fs/btrfs/lzo.c:136:64: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
136 | (u64)compressed_data, compressed_size, (u64)cur_out, sectorsize, *cur_out);
| ^
include/linux/printk.h:418:33: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
fs/btrfs/lzo.c:135:9: note: in expansion of macro 'printk'
135 | printk(KERN_DEBUG "DBG: compressed_data=0x%llx compressed_size=%lu cur_out=0x%llx sectorsize=%u cur_out=%u\n",
| ^~~~~~
>> include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/linux/printk.h:418:25: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
fs/btrfs/lzo.c:135:9: note: in expansion of macro 'printk'
135 | printk(KERN_DEBUG "DBG: compressed_data=0x%llx compressed_size=%lu cur_out=0x%llx sectorsize=%u cur_out=%u\n",
| ^~~~~~
include/linux/kern_levels.h:15:25: note: in expansion of macro 'KERN_SOH'
15 | #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
| ^~~~~~~~
fs/btrfs/lzo.c:135:16: note: in expansion of macro 'KERN_DEBUG'
135 | printk(KERN_DEBUG "DBG: compressed_data=0x%llx compressed_size=%lu cur_out=0x%llx sectorsize=%u cur_out=%u\n",
| ^~~~~~~~~~
cc1: all warnings being treated as errors


vim +136 fs/btrfs/lzo.c

114
115 /*
116 * Will do:
117 *
118 * - Write a segment header into the destination
119 * - Copy the compressed buffer into the destination
120 * - Make sure we have enough space in the last sector to fit a segment header
121 * If not, we will pad at most (LZO_LEN (4)) - 1 bytes of zeros.
122 *
123 * Will allocate new pages when needed.
124 */
125 static int copy_compressed_data_to_page(char *compressed_data,
126 size_t compressed_size,
127 struct page **out_pages,
128 u32 *cur_out,
129 const u32 sectorsize)
130 {
131 u32 sector_bytes_left;
132 u32 orig_out;
133 struct page *cur_page;
134
135 printk(KERN_DEBUG "DBG: compressed_data=0x%llx compressed_size=%lu cur_out=0x%llx sectorsize=%u cur_out=%u\n",
> 136 (u64)compressed_data, compressed_size, (u64)cur_out, sectorsize, *cur_out);
137
138 /*
139 * We never allow a segment header crossing sector boundary, previous
140 * run should ensure we have enough space left inside the sector.
141 */
142 ASSERT((*cur_out / sectorsize) ==
143 (*cur_out + LZO_LEN - 1) / sectorsize);
144
145 cur_page = out_pages[*cur_out / PAGE_SIZE];
146 /* Allocate a new page */
147 if (!cur_page) {
148 cur_page = alloc_page(GFP_NOFS);
149 if (!cur_page)
150 return -ENOMEM;
151 out_pages[*cur_out / PAGE_SIZE] = cur_page;
152 }
153
154 write_compress_length(page_address(cur_page) + offset_in_page(*cur_out),
155 compressed_size);
156 *cur_out += LZO_LEN;
157
158 orig_out = *cur_out;
159 /* *cur_out is increased, let the main loop to grab a proper page */
160 cur_page = NULL;
161
162 /* Copy compressed data */
163 while (*cur_out - orig_out < compressed_size) {
164 u32 copy_len = min_t(u32, sectorsize - *cur_out % sectorsize,
165 orig_out + compressed_size - *cur_out);
166
167 /* Grab a page or allocate a new one */
168 if (!cur_page) {
169 cur_page = out_pages[*cur_out / PAGE_SIZE];
170 if (!cur_page) {
171 cur_page = alloc_page(GFP_NOFS);
172 if (!cur_page)
173 return -ENOMEM;
174 out_pages[*cur_out / PAGE_SIZE] = cur_page;
175 }
176 }
177
178 memcpy(page_address(cur_page) + offset_in_page(*cur_out),
179 compressed_data + *cur_out - orig_out, copy_len);
180
181 *cur_out += copy_len;
182
183 /* If we reached page boudnary, go to next page */
184 if (IS_ALIGNED(*cur_out, PAGE_SIZE)) {
185 /* Let next iteration to grab a page */
186 cur_page = NULL;
187 }
188 }
189
190 /*
191 * Check if we can fit the next segment header into the remaining space
192 * of the sector.
193 */
194 sector_bytes_left = round_up(*cur_out, sectorsize) - *cur_out;
195 if (sector_bytes_left >= LZO_LEN)
196 return 0;
197
198 /* The remaining size is not enough, pad it with zeros */
199 memset(page_address(cur_page) + offset_in_page(*cur_out), 0,
200 sector_bytes_left);
201 *cur_out += sector_bytes_left;
202 return 0;
203 }
204

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip