From: kbuild test robot <lkp@intel.com>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: kbuild-all@01.org, linux-fsdevel@vger.kernel.org, hch@lst.de,
adilger@dilger.ca, jaegeuk@kernel.org, darrick.wong@oracle.com,
miklos@szeredi.hu, rpeterso@redhat.com,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/9] fiemap: Use a callback to fill fiemap extents
Date: Fri, 9 Aug 2019 08:04:56 +0800 [thread overview]
Message-ID: <201908090808.UlvbBeuF%lkp@intel.com> (raw)
In-Reply-To: <20190808082744.31405-8-cmaiolino@redhat.com>
Hi Carlos,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[cannot apply to v5.3-rc3 next-20190808]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Carlos-Maiolino/New-fiemap-infrastructure-and-bmap-removal/20190808-221354
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> fs/ioctl.c:87:52: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct fiemap_extent [noderef] <asn:1> *dest @@ got n:1> *dest @@
>> fs/ioctl.c:87:52: sparse: expected struct fiemap_extent [noderef] <asn:1> *dest
>> fs/ioctl.c:87:52: sparse: got void *fi_cb_data
fs/ioctl.c:83:5: sparse: sparse: symbol 'fiemap_fill_user_extent' was not declared. Should it be static?
>> fs/ioctl.c:218:28: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *[assigned] fi_cb_data @@ got struct fiemap_extent [nvoid *[assigned] fi_cb_data @@
>> fs/ioctl.c:218:28: sparse: expected void *[assigned] fi_cb_data
>> fs/ioctl.c:218:28: sparse: got struct fiemap_extent [noderef] <asn:1> *
>> fs/ioctl.c:224:14: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got oderef] <asn:1> * @@
>> fs/ioctl.c:224:14: sparse: expected void const volatile [noderef] <asn:1> *
>> fs/ioctl.c:224:14: sparse: got void *[assigned] fi_cb_data
vim +87 fs/ioctl.c
79
80 #define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC)
81 #define SET_NO_UNMOUNTED_IO_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED)
82 #define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
83 int fiemap_fill_user_extent(struct fiemap_extent_info *fieinfo, u64 logical,
84 u64 phys, u64 len, u32 flags)
85 {
86 struct fiemap_extent extent;
> 87 struct fiemap_extent __user *dest = fieinfo->fi_cb_data;
88
89 /* only count the extents */
90 if (fieinfo->fi_extents_max == 0) {
91 fieinfo->fi_extents_mapped++;
92 return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
93 }
94
95 if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
96 return 1;
97
98 if (flags & SET_UNKNOWN_FLAGS)
99 flags |= FIEMAP_EXTENT_UNKNOWN;
100 if (flags & SET_NO_UNMOUNTED_IO_FLAGS)
101 flags |= FIEMAP_EXTENT_ENCODED;
102 if (flags & SET_NOT_ALIGNED_FLAGS)
103 flags |= FIEMAP_EXTENT_NOT_ALIGNED;
104
105 memset(&extent, 0, sizeof(extent));
106 extent.fe_logical = logical;
107 extent.fe_physical = phys;
108 extent.fe_length = len;
109 extent.fe_flags = flags;
110
111 dest += fieinfo->fi_extents_mapped;
112 if (copy_to_user(dest, &extent, sizeof(extent)))
113 return -EFAULT;
114
115 fieinfo->fi_extents_mapped++;
116 if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
117 return 1;
118 return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
119 }
120
121 /**
122 * fiemap_fill_next_extent - Fiemap helper function
123 * @fieinfo: Fiemap context passed into ->fiemap
124 * @logical: Extent logical start offset, in bytes
125 * @phys: Extent physical start offset, in bytes
126 * @len: Extent length, in bytes
127 * @flags: FIEMAP_EXTENT flags that describe this extent
128 *
129 * Called from file system ->fiemap callback. Will populate extent
130 * info as passed in via arguments and copy to user memory. On
131 * success, extent count on fieinfo is incremented.
132 *
133 * Returns 0 on success, -errno on error, 1 if this was the last
134 * extent that will fit in user array.
135 */
136 int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
137 u64 phys, u64 len, u32 flags)
138 {
139 return fieinfo->fi_cb(fieinfo, logical, phys, len, flags);
140 }
141 EXPORT_SYMBOL(fiemap_fill_next_extent);
142
143 /**
144 * fiemap_check_flags - check validity of requested flags for fiemap
145 * @fieinfo: Fiemap context passed into ->fiemap
146 * @fs_flags: Set of fiemap flags that the file system understands
147 *
148 * Called from file system ->fiemap callback. This will compute the
149 * intersection of valid fiemap flags and those that the fs supports. That
150 * value is then compared against the user supplied flags. In case of bad user
151 * flags, the invalid values will be written into the fieinfo structure, and
152 * -EBADR is returned, which tells ioctl_fiemap() to return those values to
153 * userspace. For this reason, a return code of -EBADR should be preserved.
154 *
155 * Returns 0 on success, -EBADR on bad flags.
156 */
157 int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags)
158 {
159 u32 incompat_flags;
160
161 incompat_flags = fieinfo->fi_flags & ~(FIEMAP_FLAGS_COMPAT & fs_flags);
162 if (incompat_flags) {
163 fieinfo->fi_flags = incompat_flags;
164 return -EBADR;
165 }
166 return 0;
167 }
168 EXPORT_SYMBOL(fiemap_check_flags);
169
170 static int fiemap_check_ranges(struct super_block *sb,
171 u64 start, u64 len, u64 *new_len)
172 {
173 u64 maxbytes = (u64) sb->s_maxbytes;
174
175 *new_len = len;
176
177 if (len == 0)
178 return -EINVAL;
179
180 if (start > maxbytes)
181 return -EFBIG;
182
183 /*
184 * Shrink request scope to what the fs can actually handle.
185 */
186 if (len > maxbytes || (maxbytes - len) < start)
187 *new_len = maxbytes - start;
188
189 return 0;
190 }
191
192 static int ioctl_fiemap(struct file *filp, unsigned long arg)
193 {
194 struct fiemap fiemap;
195 struct fiemap __user *ufiemap = (struct fiemap __user *) arg;
196 struct fiemap_extent_info fieinfo = { 0, };
197 struct inode *inode = file_inode(filp);
198 struct super_block *sb = inode->i_sb;
199 u64 len;
200 int error;
201
202 if (!inode->i_op->fiemap)
203 return -EOPNOTSUPP;
204
205 if (copy_from_user(&fiemap, ufiemap, sizeof(fiemap)))
206 return -EFAULT;
207
208 if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
209 return -EINVAL;
210
211 error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
212 &len);
213 if (error)
214 return error;
215
216 fieinfo.fi_flags = fiemap.fm_flags;
217 fieinfo.fi_extents_max = fiemap.fm_extent_count;
> 218 fieinfo.fi_cb_data = ufiemap->fm_extents;
219 fieinfo.fi_start = fiemap.fm_start;
220 fieinfo.fi_len = len;
221 fieinfo.fi_cb = fiemap_fill_user_extent;
222
223 if (fiemap.fm_extent_count != 0 &&
> 224 !access_ok(fieinfo.fi_cb_data,
225 fieinfo.fi_extents_max * sizeof(struct fiemap_extent)))
226 return -EFAULT;
227
228 if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
229 filemap_write_and_wait(inode->i_mapping);
230
231 error = inode->i_op->fiemap(inode, &fieinfo);
232 fiemap.fm_flags = fieinfo.fi_flags;
233 fiemap.fm_mapped_extents = fieinfo.fi_extents_mapped;
234 if (copy_to_user(ufiemap, &fiemap, sizeof(fiemap)))
235 error = -EFAULT;
236
237 return error;
238 }
239
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
next prev parent reply other threads:[~2019-08-09 0:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 8:27 [PATCH 0/9 V5] New ->fiemap infrastructure and ->bmap removal Carlos Maiolino
2019-08-08 8:27 ` [PATCH 1/9] fs: Enable bmap() function to properly return errors Carlos Maiolino
2019-08-08 21:24 ` kbuild test robot
2019-08-14 11:14 ` Christoph Hellwig
2019-08-20 11:36 ` Carlos Maiolino
2019-08-08 8:27 ` [PATCH 2/9] cachefiles: drop direct usage of ->bmap method Carlos Maiolino
2019-08-14 11:15 ` Christoph Hellwig
2019-08-20 11:57 ` Carlos Maiolino
2019-08-20 12:50 ` David Howells
2019-08-29 7:13 ` Christoph Hellwig
2019-08-30 16:17 ` David Howells
2019-08-30 16:59 ` Christoph Hellwig
2019-08-31 0:45 ` David Howells
2019-09-05 22:44 ` Dave Chinner
2019-08-20 13:31 ` David Howells
2019-08-08 8:27 ` [PATCH 3/9] ecryptfs: drop direct calls to ->bmap Carlos Maiolino
2019-08-08 22:50 ` kbuild test robot
2019-08-08 8:27 ` [PATCH 4/9] fibmap: Use bmap instead of ->bmap method in ioctl_fibmap Carlos Maiolino
2019-08-08 20:38 ` kbuild test robot
2019-08-14 11:01 ` Carlos Maiolino
2019-08-14 11:08 ` Christoph Hellwig
2019-08-08 8:27 ` [PATCH 5/9] fs: Move start and length fiemap fields into fiemap_extent_info Carlos Maiolino
2019-08-08 20:21 ` kbuild test robot
2019-08-08 8:27 ` [PATCH 6/9] iomap: Remove length and start fields from iomap_fiemap Carlos Maiolino
2019-08-08 8:27 ` [PATCH 7/9] fiemap: Use a callback to fill fiemap extents Carlos Maiolino
2019-08-09 0:04 ` kbuild test robot [this message]
2019-08-14 11:16 ` Christoph Hellwig
2019-08-08 8:27 ` [PATCH 8/9] Use FIEMAP for FIBMAP calls Carlos Maiolino
2019-08-08 8:27 ` Carlos Maiolino
2019-08-09 1:56 ` kbuild test robot
2019-08-14 11:18 ` Christoph Hellwig
2019-08-20 13:01 ` Carlos Maiolino
2019-08-29 7:15 ` Christoph Hellwig
2019-09-10 12:28 ` Carlos Maiolino
2019-09-16 15:58 ` Darrick J. Wong
2019-08-08 8:27 ` [PATCH 9/9] xfs: Get rid of ->bmap Carlos Maiolino
-- strict thread matches above, loose matches on Subject: below --
2019-09-11 13:43 [PATCH 0/9 V6] New ->fiemap infrastructure and ->bmap removal Carlos Maiolino
2019-09-11 13:43 ` [PATCH 7/9] fiemap: Use a callback to fill fiemap extents Carlos Maiolino
2019-07-31 14:12 [PATCH 0/9 V4] New ->fiemap infrastructure and ->bmap removal Carlos Maiolino
2019-07-31 14:12 ` [PATCH 7/9] fiemap: Use a callback to fill fiemap extents Carlos Maiolino
2019-07-31 23:26 ` Darrick J. Wong
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=201908090808.UlvbBeuF%lkp@intel.com \
--to=lkp@intel.com \
--cc=adilger@dilger.ca \
--cc=cmaiolino@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--cc=kbuild-all@01.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=rpeterso@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.