Re: [PATCH 3/3] block: fops: handle IOCB_USE_PI in direct IO
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211028112406.101314-4-a.buev(a)yadro.com>
References: <20211028112406.101314-4-a.buev(a)yadro.com>
TO: "Alexander V. Buev" <a.buev(a)yadro.com>
TO: linux-block(a)vger.kernel.org
CC: Jens Axboe <axboe(a)kernel.dk>
CC: Christoph Hellwig <hch(a)lst.de>
CC: "Martin K . Petersen" <martin.petersen(a)oracle.com>
CC: Mikhail Malygin <m.malygin(a)yadro.com>
CC: linux(a)yadro.com
CC: "Alexander V. Buev" <a.buev(a)yadro.com>
Hi "Alexander,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.15-rc7]
[cannot apply to axboe-block/for-next hch-configfs/for-next next-20211029]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Alexander-V-Buev/implement-direc...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1fc596a56b334f4d593a2b49e5ff55af6aaa0816
:::::: branch date: 28 hours ago
:::::: commit date: 28 hours ago
config: i386-randconfig-c001-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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/0day-ci/linux/commit/48606c737ef4eeab1fd098ed57d9966dd...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexander-V-Buev/implement-direct-IO-with-integrity/20211028-193652
git checkout 48606c737ef4eeab1fd098ed57d9966dd73b97c3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
return IS_ERR_VALUE((unsigned long)ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1222:6: note: Returning from 'IS_ERR'
if (IS_ERR(bmp_vi)) {
^~~~~~~~~~~~~~
fs/ntfs/dir.c:1222:2: note: Taking false branch
if (IS_ERR(bmp_vi)) {
^
fs/ntfs/dir.c:1230:15: note: Assuming the condition is false
if (unlikely(bmp_pos >> 3 >= i_size_read(bmp_vi))) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
fs/ntfs/dir.c:1230:2: note: Taking false branch
if (unlikely(bmp_pos >> 3 >= i_size_read(bmp_vi))) {
^
fs/ntfs/dir.c:1239:2: note: Taking false branch
ntfs_debug("Reading bitmap with page index 0x%llx, bit ofs 0x%llx",
^
fs/ntfs/debug.h:39:2: note: expanded from macro 'ntfs_debug'
if (0) \
^
fs/ntfs/dir.c:1239:2: note: Loop condition is false. Exiting loop
ntfs_debug("Reading bitmap with page index 0x%llx, bit ofs 0x%llx",
^
fs/ntfs/debug.h:37:35: note: expanded from macro 'ntfs_debug'
#define ntfs_debug(fmt, ...) \
^
fs/ntfs/dir.c:1245:6: note: Calling 'IS_ERR'
if (IS_ERR(bmp_page)) {
^~~~~~~~~~~~~~~~
include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
return IS_ERR_VALUE((unsigned long)ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1245:6: note: Returning from 'IS_ERR'
if (IS_ERR(bmp_page)) {
^~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1245:2: note: Taking false branch
if (IS_ERR(bmp_page)) {
^
fs/ntfs/dir.c:1253:2: note: Loop condition is false. Execution continues on line 1272
while (!(bmp[cur_bmp_pos >> 3] & (1 << (cur_bmp_pos & 7)))) {
^
fs/ntfs/dir.c:1272:2: note: Taking false branch
ntfs_debug("Handling index buffer 0x%llx.",
^
fs/ntfs/debug.h:39:2: note: expanded from macro 'ntfs_debug'
if (0) \
^
fs/ntfs/dir.c:1272:2: note: Loop condition is false. Exiting loop
ntfs_debug("Handling index buffer 0x%llx.",
^
fs/ntfs/debug.h:37:35: note: expanded from macro 'ntfs_debug'
#define ntfs_debug(fmt, ...) \
^
fs/ntfs/dir.c:1275:6: note: Assuming the condition is false
if ((prev_ia_pos & (s64)PAGE_MASK) !=
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1275:2: note: Taking false branch
if ((prev_ia_pos & (s64)PAGE_MASK) !=
^
fs/ntfs/dir.c:1297:2: note: Null pointer value stored to 'ia'
ia = (INDEX_ALLOCATION*)(kaddr + (ia_pos & ~PAGE_MASK &
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1300:15: note: 'ia' is >= 'kaddr'
if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
fs/ntfs/dir.c:1300:15: note: Left side of '||' is false
if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
^
fs/ntfs/dir.c:1300:2: note: Taking false branch
if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
^
fs/ntfs/dir.c:1306:36: note: Access to field 'magic' results in a dereference of a null pointer (loaded from variable 'ia')
if (unlikely(!ntfs_is_indx_record(ia->magic))) {
^
fs/ntfs/layout.h:139:50: note: expanded from macro 'ntfs_is_indx_record'
#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) )
^
fs/ntfs/layout.h:124:45: note: expanded from macro 'ntfs_is_magic'
#define ntfs_is_magic(x, m) __ntfs_is_magic(x, magic_##m)
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
>> block/fops.c:294:24: warning: Access to field 'iov_base' results in a dereference of an undefined pointer value (loaded from variable 'pi_iov') [clang-analyzer-core.NullDereference]
_pi_iov.iov_base = pi_iov->iov_base;
^~~~~~
block/fops.c:200:16: note: 'pi_iov' declared without an initial value
struct iovec *pi_iov, _pi_iov;
^~~~~~
block/fops.c:201:17: note: Assuming the condition is true
bool is_poll = (iocb->ki_flags & IOCB_HIPRI) != 0;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/fops.c:207:6: note: Assuming the condition is false
if (iocb->ki_flags & IOCB_USE_PI) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/fops.c:207:2: note: Taking false branch
if (iocb->ki_flags & IOCB_USE_PI) {
^
block/fops.c:233:6: note: Assuming the condition is false
if ((pos | iov_iter_alignment(iter)) &
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/fops.c:233:2: note: Taking false branch
if ((pos | iov_iter_alignment(iter)) &
^
block/fops.c:239:8: note: Left side of '&&' is false
dio = container_of(bio, struct blkdev_dio, bio);
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
block/fops.c:239:8: note: Taking false branch
dio = container_of(bio, struct blkdev_dio, bio);
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
block/fops.c:239:8: note: Loop condition is false. Exiting loop
dio = container_of(bio, struct blkdev_dio, bio);
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
do { \
^
block/fops.c:241:11: note: Field 'is_sync' is false
if (dio->is_sync) {
^
block/fops.c:241:2: note: Taking false branch
if (dio->is_sync) {
^
block/fops.c:250:22: note: 'is_read' is false
dio->should_dirty = is_read && iter_is_iovec(iter);
^~~~~~~
block/fops.c:250:30: note: Left side of '&&' is false
dio->should_dirty = is_read && iter_is_iovec(iter);
^
block/fops.c:256:7: note: 'is_poll' is true
if (!is_poll)
^~~~~~~
block/fops.c:256:2: note: Taking false branch
if (!is_poll)
^
block/fops.c:259:2: note: Loop condition is true. Entering loop body
for (;;) {
^
block/fops.c:260:3: note: Assuming 'bdev' is equal to field 'bi_bdev'
bio_set_dev(bio, bdev);
^
include/linux/bio.h:495:6: note: expanded from macro 'bio_set_dev'
if ((bio)->bi_bdev != (bdev)) \
^~~~~~~~~~~~~~~~~~~~~~~~
block/fops.c:260:3: note: Taking false branch
bio_set_dev(bio, bdev);
^
include/linux/bio.h:495:2: note: expanded from macro 'bio_set_dev'
if ((bio)->bi_bdev != (bdev)) \
^
block/fops.c:260:3: note: Loop condition is false. Exiting loop
bio_set_dev(bio, bdev);
^
include/linux/bio.h:492:36: note: expanded from macro 'bio_set_dev'
#define bio_set_dev(bio, bdev) \
vim +294 block/fops.c
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 190
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 191 static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 192 unsigned int nr_pages)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 193 {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 194 struct file *file = iocb->ki_filp;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 195 struct inode *inode = bdev_file_inode(file);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 196 struct block_device *bdev = I_BDEV(inode);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 197 struct blk_plug plug;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 198 struct blkdev_dio *dio;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 199 struct bio *bio;
48606c737ef4ee Alexander V. Buev 2021-10-28 200 struct iovec *pi_iov, _pi_iov;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 201 bool is_poll = (iocb->ki_flags & IOCB_HIPRI) != 0;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 202 bool is_read = (iov_iter_rw(iter) == READ), is_sync;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 203 loff_t pos = iocb->ki_pos;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 204 blk_qc_t qc = BLK_QC_T_NONE;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 205 int ret = 0;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 206
48606c737ef4ee Alexander V. Buev 2021-10-28 207 if (iocb->ki_flags & IOCB_USE_PI) {
48606c737ef4ee Alexander V. Buev 2021-10-28 208 struct blk_integrity *bi = blk_get_integrity(bdev->bd_disk);
48606c737ef4ee Alexander V. Buev 2021-10-28 209 unsigned int intervals;
48606c737ef4ee Alexander V. Buev 2021-10-28 210
48606c737ef4ee Alexander V. Buev 2021-10-28 211 /* Last iovec contains protection information. */
48606c737ef4ee Alexander V. Buev 2021-10-28 212 if (!iter->nr_segs)
48606c737ef4ee Alexander V. Buev 2021-10-28 213 return -EINVAL;
48606c737ef4ee Alexander V. Buev 2021-10-28 214
48606c737ef4ee Alexander V. Buev 2021-10-28 215 iter->nr_segs--;
48606c737ef4ee Alexander V. Buev 2021-10-28 216 pi_iov = (struct iovec *)(iter->iov + iter->nr_segs);
48606c737ef4ee Alexander V. Buev 2021-10-28 217
48606c737ef4ee Alexander V. Buev 2021-10-28 218 /* TODO: seems iter is in charge of this check ? */
48606c737ef4ee Alexander V. Buev 2021-10-28 219 if (pi_iov->iov_len > iter->count)
48606c737ef4ee Alexander V. Buev 2021-10-28 220 return -EINVAL;
48606c737ef4ee Alexander V. Buev 2021-10-28 221
48606c737ef4ee Alexander V. Buev 2021-10-28 222 iter->count -= pi_iov->iov_len;
48606c737ef4ee Alexander V. Buev 2021-10-28 223
48606c737ef4ee Alexander V. Buev 2021-10-28 224 intervals = bio_integrity_intervals(bi, iter->count >> 9);
48606c737ef4ee Alexander V. Buev 2021-10-28 225 if (unlikely(intervals * bi->tuple_size > pi_iov->iov_len)) {
48606c737ef4ee Alexander V. Buev 2021-10-28 226 pr_err("Integrity & data size mismatch data=%lu integrity=%u intervals=%u tupple=%u",
48606c737ef4ee Alexander V. Buev 2021-10-28 227 iter->count, (unsigned int)pi_iov->iov_len,
48606c737ef4ee Alexander V. Buev 2021-10-28 228 intervals, bi->tuple_size);
48606c737ef4ee Alexander V. Buev 2021-10-28 229 return -EINVAL;
48606c737ef4ee Alexander V. Buev 2021-10-28 230 }
48606c737ef4ee Alexander V. Buev 2021-10-28 231 }
48606c737ef4ee Alexander V. Buev 2021-10-28 232
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 233 if ((pos | iov_iter_alignment(iter)) &
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 234 (bdev_logical_block_size(bdev) - 1))
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 235 return -EINVAL;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 236
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 237 bio = bio_alloc_kiocb(iocb, nr_pages, &blkdev_dio_pool);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 238
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 239 dio = container_of(bio, struct blkdev_dio, bio);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 240 dio->is_sync = is_sync = is_sync_kiocb(iocb);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 241 if (dio->is_sync) {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 242 dio->waiter = current;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 243 bio_get(bio);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 244 } else {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 245 dio->iocb = iocb;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 246 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 247
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 248 dio->size = 0;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 249 dio->multi_bio = false;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 250 dio->should_dirty = is_read && iter_is_iovec(iter);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 251
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 252 /*
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 253 * Don't plug for HIPRI/polled IO, as those should go straight
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 254 * to issue
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 255 */
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 256 if (!is_poll)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 257 blk_start_plug(&plug);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 258
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 259 for (;;) {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 260 bio_set_dev(bio, bdev);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 261 bio->bi_iter.bi_sector = pos >> 9;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 262 bio->bi_write_hint = iocb->ki_hint;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 263 bio->bi_private = dio;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 264 bio->bi_end_io = blkdev_bio_end_io;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 265 bio->bi_ioprio = iocb->ki_ioprio;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 266
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 267 ret = bio_iov_iter_get_pages(bio, iter);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 268 if (unlikely(ret)) {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 269 bio->bi_status = BLK_STS_IOERR;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 270 bio_endio(bio);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 271 break;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 272 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 273
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 274 if (is_read) {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 275 bio->bi_opf = REQ_OP_READ;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 276 if (dio->should_dirty)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 277 bio_set_pages_dirty(bio);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 278 } else {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 279 bio->bi_opf = dio_bio_write_op(iocb);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 280 task_io_account_write(bio->bi_iter.bi_size);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 281 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 282 if (iocb->ki_flags & IOCB_NOWAIT)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 283 bio->bi_opf |= REQ_NOWAIT;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 284
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 285 dio->size += bio->bi_iter.bi_size;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 286 pos += bio->bi_iter.bi_size;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 287
48606c737ef4ee Alexander V. Buev 2021-10-28 288 /* in case we can't add all data to one bio */
48606c737ef4ee Alexander V. Buev 2021-10-28 289 /* we must split integrity too */
48606c737ef4ee Alexander V. Buev 2021-10-28 290
48606c737ef4ee Alexander V. Buev 2021-10-28 291 if (iocb->ki_flags & IOCB_USE_PI) {
48606c737ef4ee Alexander V. Buev 2021-10-28 292 struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev);
48606c737ef4ee Alexander V. Buev 2021-10-28 293
48606c737ef4ee Alexander V. Buev 2021-10-28 @294 _pi_iov.iov_base = pi_iov->iov_base;
48606c737ef4ee Alexander V. Buev 2021-10-28 295 _pi_iov.iov_base += bio_integrity_bytes(bi, (dio->size-bio->bi_iter.bi_size) >> 9);
48606c737ef4ee Alexander V. Buev 2021-10-28 296 _pi_iov.iov_len = bio_integrity_bytes(bi, bio->bi_iter.bi_size >> 9);
48606c737ef4ee Alexander V. Buev 2021-10-28 297 }
48606c737ef4ee Alexander V. Buev 2021-10-28 298
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 299 nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_VECS);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 300 if (!nr_pages) {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 301 bool polled = false;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 302
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 303 if (iocb->ki_flags & IOCB_HIPRI) {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 304 bio_set_polled(bio, iocb);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 305 polled = true;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 306 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 307
48606c737ef4ee Alexander V. Buev 2021-10-28 308 /* Add protection information to bio */
48606c737ef4ee Alexander V. Buev 2021-10-28 309 if (iocb->ki_flags & IOCB_USE_PI) {
48606c737ef4ee Alexander V. Buev 2021-10-28 310 ret = bio_integrity_add_pi_iovec(bio, &_pi_iov);
48606c737ef4ee Alexander V. Buev 2021-10-28 311 if (ret) {
48606c737ef4ee Alexander V. Buev 2021-10-28 312 bio->bi_status = BLK_STS_IOERR;
48606c737ef4ee Alexander V. Buev 2021-10-28 313 bio_endio(bio);
48606c737ef4ee Alexander V. Buev 2021-10-28 314 break;
48606c737ef4ee Alexander V. Buev 2021-10-28 315 }
48606c737ef4ee Alexander V. Buev 2021-10-28 316 }
48606c737ef4ee Alexander V. Buev 2021-10-28 317
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 318 qc = submit_bio(bio);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 319
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 320 if (polled)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 321 WRITE_ONCE(iocb->ki_cookie, qc);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 322 break;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 323 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 324
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 325 if (!dio->multi_bio) {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 326 /*
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 327 * AIO needs an extra reference to ensure the dio
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 328 * structure which is embedded into the first bio
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 329 * stays around.
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 330 */
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 331 if (!is_sync)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 332 bio_get(bio);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 333 dio->multi_bio = true;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 334 atomic_set(&dio->ref, 2);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 335 } else {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 336 atomic_inc(&dio->ref);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 337 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 338
48606c737ef4ee Alexander V. Buev 2021-10-28 339
48606c737ef4ee Alexander V. Buev 2021-10-28 340 if (iocb->ki_flags & IOCB_USE_PI) {
48606c737ef4ee Alexander V. Buev 2021-10-28 341 ret = bio_integrity_add_pi_iovec(bio, &_pi_iov);
48606c737ef4ee Alexander V. Buev 2021-10-28 342 if (ret) {
48606c737ef4ee Alexander V. Buev 2021-10-28 343 bio->bi_status = BLK_STS_IOERR;
48606c737ef4ee Alexander V. Buev 2021-10-28 344 bio_endio(bio);
48606c737ef4ee Alexander V. Buev 2021-10-28 345 break;
48606c737ef4ee Alexander V. Buev 2021-10-28 346 }
48606c737ef4ee Alexander V. Buev 2021-10-28 347 }
48606c737ef4ee Alexander V. Buev 2021-10-28 348
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 349 submit_bio(bio);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 350 bio = bio_alloc(GFP_KERNEL, nr_pages);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 351 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 352
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 353 if (!is_poll)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 354 blk_finish_plug(&plug);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 355
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 356 if (!is_sync)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 357 return -EIOCBQUEUED;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 358
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 359 for (;;) {
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 360 set_current_state(TASK_UNINTERRUPTIBLE);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 361 if (!READ_ONCE(dio->waiter))
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 362 break;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 363
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 364 if (!(iocb->ki_flags & IOCB_HIPRI) ||
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 365 !blk_poll(bdev_get_queue(bdev), qc, true))
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 366 blk_io_schedule();
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 367 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 368 __set_current_state(TASK_RUNNING);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 369
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 370 if (!ret)
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 371 ret = blk_status_to_errno(dio->bio.bi_status);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 372 if (likely(!ret))
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 373 ret = dio->size;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 374
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 375 bio_put(&dio->bio);
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 376 return ret;
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 377 }
cd82cca7ebfe9c Christoph Hellwig 2021-09-07 378
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[osandov:btrfs-send-encoded 9/14] fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: Omar Sandoval <osandov(a)osandov.com>
CC: linux-kernel(a)vger.kernel.org
TO: Omar Sandoval <osandov(a)fb.com>
tree: https://github.com/osandov/linux.git btrfs-send-encoded
head: b460af84b8ddd4fd78e02fec6272b70326b87861
commit: 0aea17a6398e5a7ecab69537ff062b00f6b9c20f [9/14] btrfs: add BTRFS_IOC_ENCODED_WRITE
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
config: x86_64-randconfig-c007-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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/osandov/linux/commit/0aea17a6398e5a7ecab69537ff062b00f...
git remote add osandov https://github.com/osandov/linux.git
git fetch --no-tags osandov btrfs-send-encoded
git checkout 0aea17a6398e5a7ecab69537ff062b00f6b9c20f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
drivers/hid/hid-lg4ff.c:98:8: warning: Excessive padding in 'struct lg4ff_wheel' (8 padding bytes, where 0 is optimal).
Optimal fields order:
ff_effects,
set_range,
product_id,
min_range,
max_range,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct lg4ff_wheel {
~~~~~~~^~~~~~~~~~~~~
drivers/hid/hid-lg4ff.c:98:8: note: Excessive padding in 'struct lg4ff_wheel' (8 padding bytes, where 0 is optimal). Optimal fields order: ff_effects, set_range, product_id, min_range, max_range, consider reordering the fields or adding explicit padding members
struct lg4ff_wheel {
~~~~~~~^~~~~~~~~~~~~
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
drivers/hid/hid-lg-g15.c:366:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = (ret < 0) ? ret : -EIO;
^ ~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-lg-g15.c:366:3: note: Value stored to 'ret' is never read
ret = (ret < 0) ? ret : -EIO;
^ ~~~~~~~~~~~~~~~~~~~~~~
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
Suppressed 13 warnings (13 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
Suppressed 13 warnings (13 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
Suppressed 13 warnings (13 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
fs/btrfs/ioctl.c:2080:3: warning: Value stored to 'i' is never read [clang-analyzer-deadcode.DeadStores]
i = nritems;
^ ~~~~~~~
fs/btrfs/ioctl.c:2080:3: note: Value stored to 'i' is never read
i = nritems;
^ ~~~~~~~
fs/btrfs/ioctl.c:2394:3: warning: Value stored to 'dirid' is never read [clang-analyzer-deadcode.DeadStores]
dirid = key.objectid;
^ ~~~~~~~~~~~~
fs/btrfs/ioctl.c:2394:3: note: Value stored to 'dirid' is never read
dirid = key.objectid;
^ ~~~~~~~~~~~~
fs/btrfs/ioctl.c:4631:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(super_block->label, label);
^~~~~~
fs/btrfs/ioctl.c:4631:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(super_block->label, label);
^~~~~~
>> fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
args.iovcnt = args.iovcnt;
^
fs/btrfs/ioctl.c:5191:2: note: 'Default' branch taken. Execution continues on line 5197
switch (cmd) {
^
fs/btrfs/ioctl.c:5197:9: note: Calling 'btrfs_ioctl'
return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:5033:2: note: Control jumps to 'case 1079546944:' at line 5176
switch (cmd) {
^
fs/btrfs/ioctl.c:5177:10: note: Calling 'btrfs_ioctl_encoded_write'
return btrfs_ioctl_encoded_write(file, argp, true);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4940:6: note: Assuming the condition is false
if (!capable(CAP_SYS_ADMIN)) {
^~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4940:2: note: Taking false branch
if (!capable(CAP_SYS_ADMIN)) {
^
fs/btrfs/ioctl.c:4945:6: note: Assuming the condition is false
if (!(file->f_mode & FMODE_WRITE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4945:2: note: Taking false branch
if (!(file->f_mode & FMODE_WRITE)) {
^
fs/btrfs/ioctl.c:4950:6: note: 'compat' is true
if (compat) {
^~~~~~
fs/btrfs/ioctl.c:4950:2: note: Taking true branch
if (compat) {
^
fs/btrfs/ioctl.c:4954:7: note: Calling 'copy_from_user'
if (copy_from_user(&args32, argp, sizeof(args32))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uaccess.h:191:2: note: Taking true branch
if (likely(check_copy_size(to, n, false)))
^
include/linux/uaccess.h:193:2: note: Returning value (loaded from 'n'), which participates in a condition later
return n;
^~~~~~~~
fs/btrfs/ioctl.c:4954:7: note: Returning from 'copy_from_user'
if (copy_from_user(&args32, argp, sizeof(args32))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4954:7: note: Assuming the condition is false
if (copy_from_user(&args32, argp, sizeof(args32))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4954:3: note: Taking false branch
if (copy_from_user(&args32, argp, sizeof(args32))) {
^
fs/btrfs/ioctl.c:4959:15: note: Assigned value is garbage or undefined
args.iovcnt = args.iovcnt;
^ ~~~~~~~~~~~
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
drivers/clk/clk-cdce706.c:355:22: warning: Division by zero [clang-analyzer-core.DivideZero]
return *parent_rate / div;
~~~~~~~~~~~~~^~~~~
drivers/clk/clk-cdce706.c:293:32: note: Left side of '&&' is false
struct cdce706_hw_data *hwd = to_hw_data(hw);
^
drivers/clk/clk-cdce706.c:65:26: note: expanded from macro 'to_hw_data'
#define to_hw_data(phw) (container_of((phw), struct cdce706_hw_data, hw))
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
drivers/clk/clk-cdce706.c:293:32: note: Taking false branch
struct cdce706_hw_data *hwd = to_hw_data(hw);
^
drivers/clk/clk-cdce706.c:65:26: note: expanded from macro 'to_hw_data'
#define to_hw_data(phw) (container_of((phw), struct cdce706_hw_data, hw))
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
drivers/clk/clk-cdce706.c:293:32: note: Loop condition is false. Exiting loop
struct cdce706_hw_data *hwd = to_hw_data(hw);
^
drivers/clk/clk-cdce706.c:65:26: note: expanded from macro 'to_hw_data'
#define to_hw_data(phw) (container_of((phw), struct cdce706_hw_data, hw))
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
vim +4959 fs/btrfs/ioctl.c
d38f9ac9a40338 Omar Sandoval 2019-10-09 4928
0aea17a6398e5a Omar Sandoval 2019-08-13 4929 static int btrfs_ioctl_encoded_write(struct file *file, void __user *argp,
0aea17a6398e5a Omar Sandoval 2019-08-13 4930 bool compat)
0aea17a6398e5a Omar Sandoval 2019-08-13 4931 {
0aea17a6398e5a Omar Sandoval 2019-08-13 4932 struct btrfs_ioctl_encoded_io_args args;
0aea17a6398e5a Omar Sandoval 2019-08-13 4933 struct iovec iovstack[UIO_FASTIOV];
0aea17a6398e5a Omar Sandoval 2019-08-13 4934 struct iovec *iov = iovstack;
0aea17a6398e5a Omar Sandoval 2019-08-13 4935 struct iov_iter iter;
0aea17a6398e5a Omar Sandoval 2019-08-13 4936 loff_t pos;
0aea17a6398e5a Omar Sandoval 2019-08-13 4937 struct kiocb kiocb;
0aea17a6398e5a Omar Sandoval 2019-08-13 4938 ssize_t ret;
0aea17a6398e5a Omar Sandoval 2019-08-13 4939
0aea17a6398e5a Omar Sandoval 2019-08-13 4940 if (!capable(CAP_SYS_ADMIN)) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4941 ret = -EPERM;
0aea17a6398e5a Omar Sandoval 2019-08-13 4942 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4943 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4944
0aea17a6398e5a Omar Sandoval 2019-08-13 4945 if (!(file->f_mode & FMODE_WRITE)) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4946 ret = -EBADF;
0aea17a6398e5a Omar Sandoval 2019-08-13 4947 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4948 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4949
0aea17a6398e5a Omar Sandoval 2019-08-13 4950 if (compat) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4951 #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
0aea17a6398e5a Omar Sandoval 2019-08-13 4952 struct btrfs_ioctl_encoded_io_args_32 args32;
0aea17a6398e5a Omar Sandoval 2019-08-13 4953
0aea17a6398e5a Omar Sandoval 2019-08-13 4954 if (copy_from_user(&args32, argp, sizeof(args32))) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4955 ret = -EFAULT;
0aea17a6398e5a Omar Sandoval 2019-08-13 4956 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4957 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4958 args.iov = compat_ptr(args32.iov);
0aea17a6398e5a Omar Sandoval 2019-08-13 @4959 args.iovcnt = args.iovcnt;
0aea17a6398e5a Omar Sandoval 2019-08-13 4960 memcpy(&args.offset, &args32.offset,
0aea17a6398e5a Omar Sandoval 2019-08-13 4961 sizeof(args) -
0aea17a6398e5a Omar Sandoval 2019-08-13 4962 offsetof(struct btrfs_ioctl_encoded_io_args, offset));
0aea17a6398e5a Omar Sandoval 2019-08-13 4963 #else
0aea17a6398e5a Omar Sandoval 2019-08-13 4964 return -ENOTTY;
0aea17a6398e5a Omar Sandoval 2019-08-13 4965 #endif
0aea17a6398e5a Omar Sandoval 2019-08-13 4966 } else {
0aea17a6398e5a Omar Sandoval 2019-08-13 4967 if (copy_from_user(&args, argp, sizeof(args))) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4968 ret = -EFAULT;
0aea17a6398e5a Omar Sandoval 2019-08-13 4969 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4970 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4971 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4972
0aea17a6398e5a Omar Sandoval 2019-08-13 4973 ret = -EINVAL;
0aea17a6398e5a Omar Sandoval 2019-08-13 4974 if (args.flags != 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 4975 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4976 if (memchr_inv(args.reserved, 0, sizeof(args.reserved)))
0aea17a6398e5a Omar Sandoval 2019-08-13 4977 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4978 if (args.compression == BTRFS_ENCODED_IO_COMPRESSION_NONE &&
0aea17a6398e5a Omar Sandoval 2019-08-13 4979 args.encryption == BTRFS_ENCODED_IO_ENCRYPTION_NONE)
0aea17a6398e5a Omar Sandoval 2019-08-13 4980 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4981 if (args.compression >= BTRFS_ENCODED_IO_COMPRESSION_TYPES ||
0aea17a6398e5a Omar Sandoval 2019-08-13 4982 args.encryption >= BTRFS_ENCODED_IO_ENCRYPTION_TYPES)
0aea17a6398e5a Omar Sandoval 2019-08-13 4983 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4984 if (args.unencoded_offset > args.unencoded_len)
0aea17a6398e5a Omar Sandoval 2019-08-13 4985 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4986 if (args.len > args.unencoded_len - args.unencoded_offset)
0aea17a6398e5a Omar Sandoval 2019-08-13 4987 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4988
0aea17a6398e5a Omar Sandoval 2019-08-13 4989 ret = import_iovec(WRITE, args.iov, args.iovcnt, ARRAY_SIZE(iovstack),
0aea17a6398e5a Omar Sandoval 2019-08-13 4990 &iov, &iter);
0aea17a6398e5a Omar Sandoval 2019-08-13 4991 if (ret < 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 4992 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4993
0aea17a6398e5a Omar Sandoval 2019-08-13 4994 file_start_write(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 4995
0aea17a6398e5a Omar Sandoval 2019-08-13 4996 if (iov_iter_count(&iter) == 0) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4997 ret = 0;
0aea17a6398e5a Omar Sandoval 2019-08-13 4998 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 4999 }
0aea17a6398e5a Omar Sandoval 2019-08-13 5000 pos = args.offset;
0aea17a6398e5a Omar Sandoval 2019-08-13 5001 ret = rw_verify_area(WRITE, file, &pos, args.len);
0aea17a6398e5a Omar Sandoval 2019-08-13 5002 if (ret < 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5003 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 5004
0aea17a6398e5a Omar Sandoval 2019-08-13 5005 init_sync_kiocb(&kiocb, file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5006 ret = kiocb_set_rw_flags(&kiocb, 0);
0aea17a6398e5a Omar Sandoval 2019-08-13 5007 if (ret)
0aea17a6398e5a Omar Sandoval 2019-08-13 5008 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 5009 kiocb.ki_pos = pos;
0aea17a6398e5a Omar Sandoval 2019-08-13 5010
0aea17a6398e5a Omar Sandoval 2019-08-13 5011 ret = btrfs_do_write_iter(&kiocb, &iter, &args);
0aea17a6398e5a Omar Sandoval 2019-08-13 5012 if (ret > 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5013 fsnotify_modify(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5014
0aea17a6398e5a Omar Sandoval 2019-08-13 5015 out_end_write:
0aea17a6398e5a Omar Sandoval 2019-08-13 5016 file_end_write(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5017 kfree(iov);
0aea17a6398e5a Omar Sandoval 2019-08-13 5018 out_acct:
0aea17a6398e5a Omar Sandoval 2019-08-13 5019 if (ret > 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5020 add_wchar(current, ret);
0aea17a6398e5a Omar Sandoval 2019-08-13 5021 inc_syscw(current);
0aea17a6398e5a Omar Sandoval 2019-08-13 5022 return ret;
0aea17a6398e5a Omar Sandoval 2019-08-13 5023 }
0aea17a6398e5a Omar Sandoval 2019-08-13 5024
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[osandov:btrfs-send-encoded 8/14] fs/btrfs/inode.c:10743:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: Omar Sandoval <osandov(a)osandov.com>
CC: linux-kernel(a)vger.kernel.org
TO: Omar Sandoval <osandov(a)fb.com>
tree: https://github.com/osandov/linux.git btrfs-send-encoded
head: b460af84b8ddd4fd78e02fec6272b70326b87861
commit: d38f9ac9a40338488424fe7e8058dfb2542ca2ef [8/14] btrfs: add BTRFS_IOC_ENCODED_READ
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
config: x86_64-randconfig-c007-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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/osandov/linux/commit/d38f9ac9a40338488424fe7e8058dfb25...
git remote add osandov https://github.com/osandov/linux.git
git fetch --no-tags osandov btrfs-send-encoded
git checkout d38f9ac9a40338488424fe7e8058dfb2542ca2ef
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
fs/btrfs/disk-io.c:3328:3: warning: Value stored to 'features' is never read [clang-analyzer-deadcode.DeadStores]
features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
^
fs/btrfs/disk-io.c:3328:3: note: Value stored to 'features' is never read
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
21 warnings generated.
fs/btrfs/inode.c:5063:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = btrfs_readpage(NULL, page);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5063:3: note: Value stored to 'ret' is never read
ret = btrfs_readpage(NULL, page);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5981:20: warning: The left operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
if (location.type == BTRFS_INODE_ITEM_KEY) {
^
fs/btrfs/inode.c:6047:24: note: Calling 'btrfs_lookup_dentry'
struct inode *inode = btrfs_lookup_dentry(dir, dentry);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5974:6: note: Assuming field 'len' is <= BTRFS_NAME_LEN
if (dentry->d_name.len > BTRFS_NAME_LEN)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5974:2: note: Taking false branch
if (dentry->d_name.len > BTRFS_NAME_LEN)
^
fs/btrfs/inode.c:5977:8: note: Calling 'btrfs_inode_by_name'
ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5684:6: note: Assuming 'path' is non-null
if (!path)
^~~~~
fs/btrfs/inode.c:5684:2: note: Taking false branch
if (!path)
^
fs/btrfs/inode.c:5689:2: note: Taking true branch
if (IS_ERR_OR_NULL(di)) {
^
fs/btrfs/inode.c:5690:9: note: 'di' is non-null
ret = di ? PTR_ERR(di) : -ENOENT;
^~
fs/btrfs/inode.c:5690:9: note: '?' condition is true
fs/btrfs/inode.c:5691:3: note: Control jumps to line 5706
goto out;
^
fs/btrfs/inode.c:5707:2: note: Returning without writing to 'location->type'
return ret;
^
fs/btrfs/inode.c:5977:8: note: Returning from 'btrfs_inode_by_name'
ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5978:6: note: Assuming 'ret' is >= 0
if (ret < 0)
^~~~~~~
fs/btrfs/inode.c:5978:2: note: Taking false branch
if (ret < 0)
^
fs/btrfs/inode.c:5981:20: note: The left operand of '==' is a garbage value
if (location.type == BTRFS_INODE_ITEM_KEY) {
~~~~~~~~~~~~~ ^
fs/btrfs/inode.c:7226:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
fs/btrfs/inode.c:7226:2: note: Value stored to 'ret' is never read
ret = 0;
^ ~
fs/btrfs/inode.c:7804:12: warning: Although the value stored to 'em' is used in the enclosing expression, the value is never actually read from 'em' [clang-analyzer-deadcode.DeadStores]
*map = em = em2;
^ ~~~
fs/btrfs/inode.c:7804:12: note: Although the value stored to 'em' is used in the enclosing expression, the value is never actually read from 'em'
*map = em = em2;
^ ~~~
fs/btrfs/inode.c:9542:4: warning: Value stored to 'root_log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
root_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9542:4: note: Value stored to 'root_log_pinned' is never read
root_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9546:4: warning: Value stored to 'dest_log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
dest_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9546:4: note: Value stored to 'dest_log_pinned' is never read
dest_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9662:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
fs/btrfs/inode.c:9662:2: note: Value stored to 'ret' is never read
ret = 0;
^ ~
fs/btrfs/inode.c:9833:3: warning: Value stored to 'log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9833:3: note: Value stored to 'log_pinned' is never read
log_pinned = false;
^ ~~~~~
>> fs/btrfs/inode.c:10743:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
remaining = min(geom.len, disk_io_size - cur);
^
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:31:3: note: expanded from macro '__cmp_once'
typeof(x) unique_x = (x); \
^
fs/btrfs/inode.c:10867:6: note: Assuming field 'ki_pos' is < field 'i_size'
if (iocb->ki_pos >= inode->i_size) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10867:2: note: Taking false branch
if (iocb->ki_pos >= inode->i_size) {
^
fs/btrfs/inode.c:10878:2: note: Loop condition is true. Entering loop body
for (;;) {
^
fs/btrfs/inode.c:10883:7: note: Assuming 'ret' is 0
if (ret)
^~~
fs/btrfs/inode.c:10883:3: note: Taking false branch
if (ret)
^
fs/btrfs/inode.c:10888:7: note: Assuming 'ordered' is null
if (!ordered)
^~~~~~~~
fs/btrfs/inode.c:10888:3: note: Taking true branch
if (!ordered)
^
fs/btrfs/inode.c:10889:4: note: Execution continues on line 10895
break;
^
fs/btrfs/inode.c:10897:2: note: Taking false branch
if (IS_ERR(em)) {
^
fs/btrfs/inode.c:10902:6: note: Assuming the condition is false
if (em->block_start == EXTENT_MAP_INLINE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10902:2: note: Taking false branch
if (em->block_start == EXTENT_MAP_INLINE) {
^
fs/btrfs/inode.c:10921:18: note: '__UNIQUE_ID___x2405' is >= '__UNIQUE_ID___y2406'
encoded->len = (min_t(u64, extent_map_end(em), inode->i_size) -
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^~~
fs/btrfs/inode.c:10921:18: note: '?' condition is false
encoded->len = (min_t(u64, extent_map_end(em), inode->i_size) -
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
fs/btrfs/inode.c:10923:6: note: Assuming the condition is false
if (em->block_start == EXTENT_MAP_HOLE ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10923:6: note: Left side of '||' is false
fs/btrfs/inode.c:10924:6: note: Assuming the condition is false
test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10923:2: note: Taking false branch
if (em->block_start == EXTENT_MAP_HOLE ||
^
fs/btrfs/inode.c:10928:13: note: Assuming the condition is true
} else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10928:9: note: Taking true branch
} else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
^
fs/btrfs/inode.c:10934:7: note: Assuming 'count' is >= field 'block_len'
if (em->block_len > count) {
^~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10934:3: note: Taking false branch
if (em->block_len > count) {
^
fs/btrfs/inode.c:10943:7: note: 'ret' is >= 0
if (ret < 0)
^~~
fs/btrfs/inode.c:10943:3: note: Taking false branch
vim +10743 fs/btrfs/inode.c
d38f9ac9a403384 Omar Sandoval 2019-10-09 10705
d38f9ac9a403384 Omar Sandoval 2019-10-09 10706 static int btrfs_encoded_read_regular_fill_pages(struct inode *inode, u64 offset,
d38f9ac9a403384 Omar Sandoval 2019-10-09 10707 u64 disk_io_size, struct page **pages)
d38f9ac9a403384 Omar Sandoval 2019-10-09 10708 {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10709 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10710 struct btrfs_encoded_read_private priv = {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10711 .inode = inode,
d38f9ac9a403384 Omar Sandoval 2019-10-09 10712 .pending = ATOMIC_INIT(1),
d38f9ac9a403384 Omar Sandoval 2019-10-09 10713 .skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM,
d38f9ac9a403384 Omar Sandoval 2019-10-09 10714 };
d38f9ac9a403384 Omar Sandoval 2019-10-09 10715 unsigned long i = 0;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10716 u64 cur = 0;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10717 int ret;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10718
d38f9ac9a403384 Omar Sandoval 2019-10-09 10719 init_waitqueue_head(&priv.wait);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10720 /*
d38f9ac9a403384 Omar Sandoval 2019-10-09 10721 * Submit bios for the extent, splitting due to bio or stripe limits as
d38f9ac9a403384 Omar Sandoval 2019-10-09 10722 * necessary.
d38f9ac9a403384 Omar Sandoval 2019-10-09 10723 */
d38f9ac9a403384 Omar Sandoval 2019-10-09 10724 while (cur < disk_io_size) {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10725 struct extent_map *em;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10726 struct btrfs_io_geometry geom;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10727 struct bio *bio = NULL;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10728 u64 remaining;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10729
d38f9ac9a403384 Omar Sandoval 2019-10-09 10730 em = btrfs_get_chunk_map(fs_info, offset + cur,
d38f9ac9a403384 Omar Sandoval 2019-10-09 10731 disk_io_size - cur);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10732 if (IS_ERR(em)) {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10733 ret = PTR_ERR(em);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10734 } else {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10735 ret = btrfs_get_io_geometry(fs_info, em, BTRFS_MAP_READ,
d38f9ac9a403384 Omar Sandoval 2019-10-09 10736 offset + cur, &geom);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10737 free_extent_map(em);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10738 }
d38f9ac9a403384 Omar Sandoval 2019-10-09 10739 if (ret) {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10740 WRITE_ONCE(priv.status, errno_to_blk_status(ret));
d38f9ac9a403384 Omar Sandoval 2019-10-09 10741 break;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10742 }
d38f9ac9a403384 Omar Sandoval 2019-10-09 @10743 remaining = min(geom.len, disk_io_size - cur);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10744 while (bio || remaining) {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10745 size_t bytes = min_t(u64, remaining, PAGE_SIZE);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10746
d38f9ac9a403384 Omar Sandoval 2019-10-09 10747 if (!bio) {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10748 bio = btrfs_bio_alloc(offset + cur);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10749 bio->bi_end_io = btrfs_encoded_read_endio;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10750 bio->bi_private = &priv;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10751 bio->bi_opf = REQ_OP_READ;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10752 }
d38f9ac9a403384 Omar Sandoval 2019-10-09 10753
d38f9ac9a403384 Omar Sandoval 2019-10-09 10754 if (!bytes ||
d38f9ac9a403384 Omar Sandoval 2019-10-09 10755 bio_add_page(bio, pages[i], bytes, 0) < bytes) {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10756 blk_status_t status;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10757
d38f9ac9a403384 Omar Sandoval 2019-10-09 10758 status = submit_encoded_read_bio(inode, bio, 0,
d38f9ac9a403384 Omar Sandoval 2019-10-09 10759 0);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10760 if (status) {
d38f9ac9a403384 Omar Sandoval 2019-10-09 10761 WRITE_ONCE(priv.status, status);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10762 bio_put(bio);
d38f9ac9a403384 Omar Sandoval 2019-10-09 10763 goto out;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10764 }
d38f9ac9a403384 Omar Sandoval 2019-10-09 10765 bio = NULL;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10766 continue;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10767 }
d38f9ac9a403384 Omar Sandoval 2019-10-09 10768
d38f9ac9a403384 Omar Sandoval 2019-10-09 10769 i++;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10770 cur += bytes;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10771 remaining -= bytes;
d38f9ac9a403384 Omar Sandoval 2019-10-09 10772 }
d38f9ac9a403384 Omar Sandoval 2019-10-09 10773 }
d38f9ac9a403384 Omar Sandoval 2019-10-09 10774
d38f9ac9a403384 Omar Sandoval 2019-10-09 10775 out:
d38f9ac9a403384 Omar Sandoval 2019-10-09 10776 if (atomic_dec_return(&priv.pending))
d38f9ac9a403384 Omar Sandoval 2019-10-09 10777 io_wait_event(priv.wait, !atomic_read(&priv.pending));
d38f9ac9a403384 Omar Sandoval 2019-10-09 10778 /* See btrfs_encoded_read_endio() for ordering. */
d38f9ac9a403384 Omar Sandoval 2019-10-09 10779 return blk_status_to_errno(READ_ONCE(priv.status));
d38f9ac9a403384 Omar Sandoval 2019-10-09 10780 }
d38f9ac9a403384 Omar Sandoval 2019-10-09 10781
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[linux-next:master 10189/12471] drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:111:9: sparse: sparse: dubious: x | !y
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: Shayne Chen <shayne.chen(a)mediatek.com>
CC: Felix Fietkau <nbd(a)nbd.name>
CC: Ryder Lee <ryder.lee(a)mediatek.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 503f375baa99edff894eb1a534d2ac0b4f799573
commit: 90f5daea758abcc4722f4304ed5fccbbc80a59c2 [10189/12471] mt76: mt7915: add debugfs knobs for MCU utilization
:::::: branch date: 6 hours ago
:::::: commit date: 5 days ago
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 90f5daea758abcc4722f4304ed5fccbbc80a59c2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash drivers/net/wireless/mediatek/mt76/mt7915/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:111:9: sparse: sparse: dubious: x | !y
vim +111 drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
e57b7901469fc0 Ryder Lee 2020-04-25 80
e57b7901469fc0 Ryder Lee 2020-04-25 81 DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL,
e57b7901469fc0 Ryder Lee 2020-04-25 82 mt7915_radar_trigger, "%lld\n");
e57b7901469fc0 Ryder Lee 2020-04-25 83
5517f78b0063d0 Ryder Lee 2020-04-25 84 static int
9b121acd4e853c Shayne Chen 2021-10-22 85 mt7915_fw_debug_wm_set(void *data, u64 val)
5517f78b0063d0 Ryder Lee 2020-04-25 86 {
5517f78b0063d0 Ryder Lee 2020-04-25 87 struct mt7915_dev *dev = data;
5517f78b0063d0 Ryder Lee 2020-04-25 88 enum {
5517f78b0063d0 Ryder Lee 2020-04-25 89 DEBUG_TXCMD = 62,
5517f78b0063d0 Ryder Lee 2020-04-25 90 DEBUG_CMD_RPT_TX,
5517f78b0063d0 Ryder Lee 2020-04-25 91 DEBUG_CMD_RPT_TRIG,
5517f78b0063d0 Ryder Lee 2020-04-25 92 DEBUG_SPL,
5517f78b0063d0 Ryder Lee 2020-04-25 93 DEBUG_RPT_RX,
5517f78b0063d0 Ryder Lee 2020-04-25 94 } debug;
9b121acd4e853c Shayne Chen 2021-10-22 95 int ret;
5517f78b0063d0 Ryder Lee 2020-04-25 96
9b121acd4e853c Shayne Chen 2021-10-22 97 dev->fw_debug_wm = val ? MCU_FW_LOG_TO_HOST : 0;
5517f78b0063d0 Ryder Lee 2020-04-25 98
9b121acd4e853c Shayne Chen 2021-10-22 99 ret = mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, dev->fw_debug_wm);
9b121acd4e853c Shayne Chen 2021-10-22 100 if (ret)
9b121acd4e853c Shayne Chen 2021-10-22 101 return ret;
5517f78b0063d0 Ryder Lee 2020-04-25 102
9b121acd4e853c Shayne Chen 2021-10-22 103 for (debug = DEBUG_TXCMD; debug <= DEBUG_RPT_RX; debug++) {
9b121acd4e853c Shayne Chen 2021-10-22 104 ret = mt7915_mcu_fw_dbg_ctrl(dev, debug, !!dev->fw_debug_wm);
9b121acd4e853c Shayne Chen 2021-10-22 105 if (ret)
9b121acd4e853c Shayne Chen 2021-10-22 106 return ret;
9b121acd4e853c Shayne Chen 2021-10-22 107 }
5517f78b0063d0 Ryder Lee 2020-04-25 108
90f5daea758abc Shayne Chen 2021-10-22 109 /* WM CPU info record control */
90f5daea758abc Shayne Chen 2021-10-22 110 mt76_clear(dev, MT_CPU_UTIL_CTRL, BIT(0));
90f5daea758abc Shayne Chen 2021-10-22 @111 mt76_wr(dev, MT_DIC_CMD_REG_CMD, BIT(2) | BIT(13) | !dev->fw_debug_wm);
90f5daea758abc Shayne Chen 2021-10-22 112 mt76_wr(dev, MT_MCU_WM_CIRQ_IRQ_MASK_CLR_ADDR, BIT(5));
90f5daea758abc Shayne Chen 2021-10-22 113 mt76_wr(dev, MT_MCU_WM_CIRQ_IRQ_SOFT_ADDR, BIT(5));
90f5daea758abc Shayne Chen 2021-10-22 114
5517f78b0063d0 Ryder Lee 2020-04-25 115 return 0;
5517f78b0063d0 Ryder Lee 2020-04-25 116 }
5517f78b0063d0 Ryder Lee 2020-04-25 117
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[osandov:btrfs-send-encoded 8/14] fs/btrfs/inode.c:10743:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: Omar Sandoval <osandov(a)osandov.com>
CC: linux-kernel(a)vger.kernel.org
TO: Omar Sandoval <osandov(a)fb.com>
tree: https://github.com/osandov/linux.git btrfs-send-encoded
head: b460af84b8ddd4fd78e02fec6272b70326b87861
commit: d38f9ac9a40338488424fe7e8058dfb2542ca2ef [8/14] btrfs: add BTRFS_IOC_ENCODED_READ
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
config: x86_64-randconfig-c007-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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/osandov/linux/commit/d38f9ac9a40338488424fe7e8058dfb25...
git remote add osandov https://github.com/osandov/linux.git
git fetch --no-tags osandov btrfs-send-encoded
git checkout d38f9ac9a40338488424fe7e8058dfb2542ca2ef
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
fs/btrfs/disk-io.c:3328:3: warning: Value stored to 'features' is never read [clang-analyzer-deadcode.DeadStores]
features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
^
fs/btrfs/disk-io.c:3328:3: note: Value stored to 'features' is never read
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
21 warnings generated.
fs/btrfs/inode.c:5063:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = btrfs_readpage(NULL, page);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5063:3: note: Value stored to 'ret' is never read
ret = btrfs_readpage(NULL, page);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5981:20: warning: The left operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
if (location.type == BTRFS_INODE_ITEM_KEY) {
^
fs/btrfs/inode.c:6047:24: note: Calling 'btrfs_lookup_dentry'
struct inode *inode = btrfs_lookup_dentry(dir, dentry);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5974:6: note: Assuming field 'len' is <= BTRFS_NAME_LEN
if (dentry->d_name.len > BTRFS_NAME_LEN)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5974:2: note: Taking false branch
if (dentry->d_name.len > BTRFS_NAME_LEN)
^
fs/btrfs/inode.c:5977:8: note: Calling 'btrfs_inode_by_name'
ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5684:6: note: Assuming 'path' is non-null
if (!path)
^~~~~
fs/btrfs/inode.c:5684:2: note: Taking false branch
if (!path)
^
fs/btrfs/inode.c:5689:2: note: Taking true branch
if (IS_ERR_OR_NULL(di)) {
^
fs/btrfs/inode.c:5690:9: note: 'di' is non-null
ret = di ? PTR_ERR(di) : -ENOENT;
^~
fs/btrfs/inode.c:5690:9: note: '?' condition is true
fs/btrfs/inode.c:5691:3: note: Control jumps to line 5706
goto out;
^
fs/btrfs/inode.c:5707:2: note: Returning without writing to 'location->type'
return ret;
^
fs/btrfs/inode.c:5977:8: note: Returning from 'btrfs_inode_by_name'
ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:5978:6: note: Assuming 'ret' is >= 0
if (ret < 0)
^~~~~~~
fs/btrfs/inode.c:5978:2: note: Taking false branch
if (ret < 0)
^
fs/btrfs/inode.c:5981:20: note: The left operand of '==' is a garbage value
if (location.type == BTRFS_INODE_ITEM_KEY) {
~~~~~~~~~~~~~ ^
fs/btrfs/inode.c:7226:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
fs/btrfs/inode.c:7226:2: note: Value stored to 'ret' is never read
ret = 0;
^ ~
fs/btrfs/inode.c:7804:12: warning: Although the value stored to 'em' is used in the enclosing expression, the value is never actually read from 'em' [clang-analyzer-deadcode.DeadStores]
*map = em = em2;
^ ~~~
fs/btrfs/inode.c:7804:12: note: Although the value stored to 'em' is used in the enclosing expression, the value is never actually read from 'em'
*map = em = em2;
^ ~~~
fs/btrfs/inode.c:9542:4: warning: Value stored to 'root_log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
root_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9542:4: note: Value stored to 'root_log_pinned' is never read
root_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9546:4: warning: Value stored to 'dest_log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
dest_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9546:4: note: Value stored to 'dest_log_pinned' is never read
dest_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9662:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
fs/btrfs/inode.c:9662:2: note: Value stored to 'ret' is never read
ret = 0;
^ ~
fs/btrfs/inode.c:9833:3: warning: Value stored to 'log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9833:3: note: Value stored to 'log_pinned' is never read
log_pinned = false;
^ ~~~~~
>> fs/btrfs/inode.c:10743:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
remaining = min(geom.len, disk_io_size - cur);
^
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:31:3: note: expanded from macro '__cmp_once'
typeof(x) unique_x = (x); \
^
fs/btrfs/inode.c:10867:6: note: Assuming field 'ki_pos' is < field 'i_size'
if (iocb->ki_pos >= inode->i_size) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10867:2: note: Taking false branch
if (iocb->ki_pos >= inode->i_size) {
^
fs/btrfs/inode.c:10878:2: note: Loop condition is true. Entering loop body
for (;;) {
^
fs/btrfs/inode.c:10883:7: note: Assuming 'ret' is 0
if (ret)
^~~
fs/btrfs/inode.c:10883:3: note: Taking false branch
if (ret)
^
fs/btrfs/inode.c:10888:7: note: Assuming 'ordered' is null
if (!ordered)
^~~~~~~~
fs/btrfs/inode.c:10888:3: note: Taking true branch
if (!ordered)
^
fs/btrfs/inode.c:10889:4: note: Execution continues on line 10895
break;
^
fs/btrfs/inode.c:10897:2: note: Taking false branch
if (IS_ERR(em)) {
^
fs/btrfs/inode.c:10902:6: note: Assuming the condition is false
if (em->block_start == EXTENT_MAP_INLINE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10902:2: note: Taking false branch
if (em->block_start == EXTENT_MAP_INLINE) {
^
fs/btrfs/inode.c:10921:18: note: '__UNIQUE_ID___x2405' is >= '__UNIQUE_ID___y2406'
encoded->len = (min_t(u64, extent_map_end(em), inode->i_size) -
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^~~
fs/btrfs/inode.c:10921:18: note: '?' condition is false
encoded->len = (min_t(u64, extent_map_end(em), inode->i_size) -
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
fs/btrfs/inode.c:10923:6: note: Assuming the condition is false
if (em->block_start == EXTENT_MAP_HOLE ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10923:6: note: Left side of '||' is false
fs/btrfs/inode.c:10924:6: note: Assuming the condition is false
test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10923:2: note: Taking false branch
if (em->block_start == EXTENT_MAP_HOLE ||
^
fs/btrfs/inode.c:10928:13: note: Assuming the condition is true
} else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10928:9: note: Taking true branch
} else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
^
fs/btrfs/inode.c:10934:7: note: Assuming 'count' is >= field 'block_len'
if (em->block_len > count) {
^~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10934:3: note: Taking false branch
if (em->block_len > count) {
^
fs/btrfs/inode.c:10943:7: note: 'ret' is >= 0
if (ret < 0)
^~~
fs/btrfs/inode.c:10943:3: note: Taking false branch
vim +10743 fs/btrfs/inode.c
d38f9ac9a40338 Omar Sandoval 2019-10-09 10705
d38f9ac9a40338 Omar Sandoval 2019-10-09 10706 static int btrfs_encoded_read_regular_fill_pages(struct inode *inode, u64 offset,
d38f9ac9a40338 Omar Sandoval 2019-10-09 10707 u64 disk_io_size, struct page **pages)
d38f9ac9a40338 Omar Sandoval 2019-10-09 10708 {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10709 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10710 struct btrfs_encoded_read_private priv = {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10711 .inode = inode,
d38f9ac9a40338 Omar Sandoval 2019-10-09 10712 .pending = ATOMIC_INIT(1),
d38f9ac9a40338 Omar Sandoval 2019-10-09 10713 .skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM,
d38f9ac9a40338 Omar Sandoval 2019-10-09 10714 };
d38f9ac9a40338 Omar Sandoval 2019-10-09 10715 unsigned long i = 0;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10716 u64 cur = 0;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10717 int ret;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10718
d38f9ac9a40338 Omar Sandoval 2019-10-09 10719 init_waitqueue_head(&priv.wait);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10720 /*
d38f9ac9a40338 Omar Sandoval 2019-10-09 10721 * Submit bios for the extent, splitting due to bio or stripe limits as
d38f9ac9a40338 Omar Sandoval 2019-10-09 10722 * necessary.
d38f9ac9a40338 Omar Sandoval 2019-10-09 10723 */
d38f9ac9a40338 Omar Sandoval 2019-10-09 10724 while (cur < disk_io_size) {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10725 struct extent_map *em;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10726 struct btrfs_io_geometry geom;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10727 struct bio *bio = NULL;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10728 u64 remaining;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10729
d38f9ac9a40338 Omar Sandoval 2019-10-09 10730 em = btrfs_get_chunk_map(fs_info, offset + cur,
d38f9ac9a40338 Omar Sandoval 2019-10-09 10731 disk_io_size - cur);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10732 if (IS_ERR(em)) {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10733 ret = PTR_ERR(em);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10734 } else {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10735 ret = btrfs_get_io_geometry(fs_info, em, BTRFS_MAP_READ,
d38f9ac9a40338 Omar Sandoval 2019-10-09 10736 offset + cur, &geom);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10737 free_extent_map(em);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10738 }
d38f9ac9a40338 Omar Sandoval 2019-10-09 10739 if (ret) {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10740 WRITE_ONCE(priv.status, errno_to_blk_status(ret));
d38f9ac9a40338 Omar Sandoval 2019-10-09 10741 break;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10742 }
d38f9ac9a40338 Omar Sandoval 2019-10-09 @10743 remaining = min(geom.len, disk_io_size - cur);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10744 while (bio || remaining) {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10745 size_t bytes = min_t(u64, remaining, PAGE_SIZE);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10746
d38f9ac9a40338 Omar Sandoval 2019-10-09 10747 if (!bio) {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10748 bio = btrfs_bio_alloc(offset + cur);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10749 bio->bi_end_io = btrfs_encoded_read_endio;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10750 bio->bi_private = &priv;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10751 bio->bi_opf = REQ_OP_READ;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10752 }
d38f9ac9a40338 Omar Sandoval 2019-10-09 10753
d38f9ac9a40338 Omar Sandoval 2019-10-09 10754 if (!bytes ||
d38f9ac9a40338 Omar Sandoval 2019-10-09 10755 bio_add_page(bio, pages[i], bytes, 0) < bytes) {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10756 blk_status_t status;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10757
d38f9ac9a40338 Omar Sandoval 2019-10-09 10758 status = submit_encoded_read_bio(inode, bio, 0,
d38f9ac9a40338 Omar Sandoval 2019-10-09 10759 0);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10760 if (status) {
d38f9ac9a40338 Omar Sandoval 2019-10-09 10761 WRITE_ONCE(priv.status, status);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10762 bio_put(bio);
d38f9ac9a40338 Omar Sandoval 2019-10-09 10763 goto out;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10764 }
d38f9ac9a40338 Omar Sandoval 2019-10-09 10765 bio = NULL;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10766 continue;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10767 }
d38f9ac9a40338 Omar Sandoval 2019-10-09 10768
d38f9ac9a40338 Omar Sandoval 2019-10-09 10769 i++;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10770 cur += bytes;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10771 remaining -= bytes;
d38f9ac9a40338 Omar Sandoval 2019-10-09 10772 }
d38f9ac9a40338 Omar Sandoval 2019-10-09 10773 }
d38f9ac9a40338 Omar Sandoval 2019-10-09 10774
d38f9ac9a40338 Omar Sandoval 2019-10-09 10775 out:
d38f9ac9a40338 Omar Sandoval 2019-10-09 10776 if (atomic_dec_return(&priv.pending))
d38f9ac9a40338 Omar Sandoval 2019-10-09 10777 io_wait_event(priv.wait, !atomic_read(&priv.pending));
d38f9ac9a40338 Omar Sandoval 2019-10-09 10778 /* See btrfs_encoded_read_endio() for ordering. */
d38f9ac9a40338 Omar Sandoval 2019-10-09 10779 return blk_status_to_errno(READ_ONCE(priv.status));
d38f9ac9a40338 Omar Sandoval 2019-10-09 10780 }
d38f9ac9a40338 Omar Sandoval 2019-10-09 10781
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
Re: [PATCH v8 2/2] clk: Add ccf driver for Renesas 8T49N241
by kernel test robot
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211021213106.315-3-alexander.helms.jy(a)renesas.com>
References: <20211021213106.315-3-alexander.helms.jy(a)renesas.com>
TO: Alex Helms <alexander.helms.jy(a)renesas.com>
TO: linux-kernel(a)vger.kernel.org
TO: devicetree(a)vger.kernel.org
TO: linux-clk(a)vger.kernel.org
TO: linux-renesas-soc(a)vger.kernel.org
CC: robh+dt(a)kernel.org
CC: sboyd(a)kernel.org
CC: mturquette(a)baylibre.com
CC: geert+renesas(a)glider.be
CC: alexander.helms.jy(a)renesas.com
CC: david.cater.jc(a)renesas.com
Hi Alex,
I love your patch! Perhaps something to improve:
[auto build test WARNING on 519d81956ee277b4419c723adfb154603c2565ba]
url: https://github.com/0day-ci/linux/commits/Alex-Helms/Renesas-8T49N241-devi...
base: 519d81956ee277b4419c723adfb154603c2565ba
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: x86_64-randconfig-m001-20211027 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
drivers/clk/8t49n24x-core.c:94 __renesas_i2c_write_bulk() error: uninitialized symbol 'err'.
drivers/clk/8t49n24x-core.c:372 r8t49n24x_calc_divs() warn: should 'rem << 28' be a 64 bit type?
drivers/clk/8t49n24x.c:416 r8t49n24x_probe() warn: excess argument passed to 'sprintf'
drivers/clk/8t49n24x.c:448 r8t49n24x_probe() warn: inconsistent indenting
Old smatch warnings:
drivers/clk/8t49n24x-core.c:397 r8t49n24x_calc_divs() warn: should 'rem << 21' be a 64 bit type?
vim +/err +94 drivers/clk/8t49n24x-core.c
38bfc1ee0c46d7 Alex Helms 2021-10-21 66
38bfc1ee0c46d7 Alex Helms 2021-10-21 67 int __renesas_i2c_write_bulk(struct i2c_client *client, struct regmap *map,
38bfc1ee0c46d7 Alex Helms 2021-10-21 68 unsigned int reg, u8 val[], size_t val_count)
38bfc1ee0c46d7 Alex Helms 2021-10-21 69 {
38bfc1ee0c46d7 Alex Helms 2021-10-21 70 u8 block[WRITE_BLOCK_SIZE];
38bfc1ee0c46d7 Alex Helms 2021-10-21 71 unsigned int block_offset = reg;
38bfc1ee0c46d7 Alex Helms 2021-10-21 72 unsigned int i, currentOffset = 0;
38bfc1ee0c46d7 Alex Helms 2021-10-21 73 int err;
38bfc1ee0c46d7 Alex Helms 2021-10-21 74
38bfc1ee0c46d7 Alex Helms 2021-10-21 75 dev_dbg(&client->dev,
38bfc1ee0c46d7 Alex Helms 2021-10-21 76 "I2C->0x%04x : [hex] . First byte: %02x, Second byte: %02x",
38bfc1ee0c46d7 Alex Helms 2021-10-21 77 reg, reg >> 8, reg & 0xFF);
38bfc1ee0c46d7 Alex Helms 2021-10-21 78
38bfc1ee0c46d7 Alex Helms 2021-10-21 79 print_hex_dump_debug("i2c_write_bulk: ", DUMP_PREFIX_NONE,
38bfc1ee0c46d7 Alex Helms 2021-10-21 80 16, 1, val, val_count, false);
38bfc1ee0c46d7 Alex Helms 2021-10-21 81
38bfc1ee0c46d7 Alex Helms 2021-10-21 82 for (i = 0; i < val_count; i++) {
38bfc1ee0c46d7 Alex Helms 2021-10-21 83 block[currentOffset++] = val[i];
38bfc1ee0c46d7 Alex Helms 2021-10-21 84
38bfc1ee0c46d7 Alex Helms 2021-10-21 85 if (i > 0 && (i + 1) % WRITE_BLOCK_SIZE == 0) {
38bfc1ee0c46d7 Alex Helms 2021-10-21 86 err = regmap_bulk_write(map, block_offset, block, WRITE_BLOCK_SIZE);
38bfc1ee0c46d7 Alex Helms 2021-10-21 87 if (err)
38bfc1ee0c46d7 Alex Helms 2021-10-21 88 break;
38bfc1ee0c46d7 Alex Helms 2021-10-21 89 block_offset += WRITE_BLOCK_SIZE;
38bfc1ee0c46d7 Alex Helms 2021-10-21 90 currentOffset = 0;
38bfc1ee0c46d7 Alex Helms 2021-10-21 91 }
38bfc1ee0c46d7 Alex Helms 2021-10-21 92 }
38bfc1ee0c46d7 Alex Helms 2021-10-21 93
38bfc1ee0c46d7 Alex Helms 2021-10-21 @94 if (err == 0 && currentOffset > 0)
38bfc1ee0c46d7 Alex Helms 2021-10-21 95 err = regmap_bulk_write(map, block_offset, block, currentOffset);
38bfc1ee0c46d7 Alex Helms 2021-10-21 96
38bfc1ee0c46d7 Alex Helms 2021-10-21 97 return err;
38bfc1ee0c46d7 Alex Helms 2021-10-21 98 }
38bfc1ee0c46d7 Alex Helms 2021-10-21 99
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
Re: [PATCH 2/2] hwmon: Driver for Texas Instruments INA238
by kernel test robot
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211025025805.618566-2-nathan(a)nathanrossi.com>
References: <20211025025805.618566-2-nathan(a)nathanrossi.com>
TO: Nathan Rossi <nathan(a)nathanrossi.com>
TO: linux-hwmon(a)vger.kernel.org
TO: linux-doc(a)vger.kernel.org
TO: linux-kernel(a)vger.kernel.org
CC: Nathan Rossi <nathan(a)nathanrossi.com>
CC: Jean Delvare <jdelvare(a)suse.com>
CC: Guenter Roeck <linux(a)roeck-us.net>
CC: Jonathan Corbet <corbet(a)lwn.net>
Hi Nathan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on v5.15-rc7 next-20211027]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Nathan-Rossi/Driver-for-TI-INA23...
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-m001-20211027 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/hwmon/ina238.c:304 ina238_alert_store() error: uninitialized symbol 'regval'.
vim +/regval +304 drivers/hwmon/ina238.c
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 242
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 243 static ssize_t ina238_alert_store(struct device *dev,
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 244 struct device_attribute *da,
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 245 const char *buf, size_t count)
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 246 {
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 247 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 248 struct ina238_data *data = dev_get_drvdata(dev);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 249 long long val;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 250 int regval;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 251 int ret;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 252
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 253 ret = kstrtoll(buf, 10, &val);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 254 if (ret < 0)
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 255 return ret;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 256
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 257 /* convert decimal to register value */
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 258 switch (attr->index) {
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 259 case INA238_SHUNT_OVER_VOLTAGE:
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 260 case INA238_SHUNT_UNDER_VOLTAGE:
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 261 /* signed */
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 262 regval = div_s64((val * 1000), INA238_SHUNT_VOLTAGE_LSB);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 263 if (regval > S16_MAX || regval < S16_MIN) {
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 264 ret = -EINVAL;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 265 goto abort;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 266 }
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 267 break;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 268 case INA238_BUS_OVER_VOLTAGE:
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 269 case INA238_BUS_UNDER_VOLTAGE:
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 270 regval = div_u64((val * 1000), INA238_BUS_VOLTAGE_LSB);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 271 if (regval > U16_MAX || regval < 0) {
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 272 ret = -EINVAL;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 273 goto abort;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 274 }
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 275 break;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 276 case INA238_POWER_LIMIT:
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 277 /*
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 278 * Compared against the 24-bit power register, lower 8-bits are
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 279 * truncated. Same conversion to/from uW as POWER register.
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 280 */
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 281 regval = div_u64(val * 5 * data->rshunt,
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 282 1000 * INA238_FIXED_SHUNT) >> 8;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 283 if (regval > U16_MAX || regval < 0) {
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 284 ret = -EINVAL;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 285 goto abort;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 286 }
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 287 break;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 288 case INA238_TEMP_LIMIT:
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 289 /* Bits 15-4 of register */
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 290 regval = (div_s64(val, INA238_DIE_TEMP_LSB) << 4);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 291 if (regval > S16_MAX || regval < S16_MIN) {
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 292 ret = -EINVAL;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 293 goto abort;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 294 }
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 295 regval = regval & 0xfff0;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 296 break;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 297 default:
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 298 WARN_ON_ONCE(1);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 299 break;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 300 }
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 301
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 302 mutex_lock(&data->config_lock);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 303
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 @304 ret = regmap_write(data->regmap, attr->index, regval);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 305 if (ret < 0)
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 306 goto abort;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 307
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 308 ret = count;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 309 abort:
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 310 mutex_unlock(&data->config_lock);
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 311 return ret;
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 312 }
aafb1ad1e44aa2 Nathan Rossi 2021-10-25 313
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[linux-next:master 10661/11937] drivers/gpu/drm/drm_gem_atomic_helper.c:155 drm_gem_plane_helper_prepare_fb() warn: ignoring unreachable code.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: "Christian König" <christian.koenig(a)amd.com>
CC: Daniel Vetter <daniel.vetter(a)ffwll.ch>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: ae5179317e794160e471db0e122c6ac811a97235
commit: 525bbf72dbe0004a009dc39b239dec74e8007f6f [10661/11937] drm: use new iterator in drm_gem_plane_helper_prepare_fb v3
:::::: branch date: 14 hours ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-m001-20211027 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/gpu/drm/drm_gem_atomic_helper.c:155 drm_gem_plane_helper_prepare_fb() warn: ignoring unreachable code.
vim +155 drivers/gpu/drm/drm_gem_atomic_helper.c
6dd7b6ce43acd7 Thomas Zimmermann 2021-02-08 13
6dd7b6ce43acd7 Thomas Zimmermann 2021-02-08 14 /**
6dd7b6ce43acd7 Thomas Zimmermann 2021-02-08 15 * DOC: overview
6dd7b6ce43acd7 Thomas Zimmermann 2021-02-08 16 *
6dd7b6ce43acd7 Thomas Zimmermann 2021-02-08 17 * The GEM atomic helpers library implements generic atomic-commit
6dd7b6ce43acd7 Thomas Zimmermann 2021-02-08 18 * functions for drivers that use GEM objects. Currently, it provides
820c1707177c6f Thomas Zimmermann 2021-02-22 19 * synchronization helpers, and plane state and framebuffer BO mappings
820c1707177c6f Thomas Zimmermann 2021-02-22 20 * for planes with shadow buffers.
820c1707177c6f Thomas Zimmermann 2021-02-22 21 *
820c1707177c6f Thomas Zimmermann 2021-02-22 22 * Before scanout, a plane's framebuffer needs to be synchronized with
820c1707177c6f Thomas Zimmermann 2021-02-22 23 * possible writers that draw into the framebuffer. All drivers should
820c1707177c6f Thomas Zimmermann 2021-02-22 24 * call drm_gem_plane_helper_prepare_fb() from their implementation of
820c1707177c6f Thomas Zimmermann 2021-02-22 25 * struct &drm_plane_helper.prepare_fb . It sets the plane's fence from
820c1707177c6f Thomas Zimmermann 2021-02-22 26 * the framebuffer so that the DRM core can synchronize access automatically.
820c1707177c6f Thomas Zimmermann 2021-02-22 27 *
820c1707177c6f Thomas Zimmermann 2021-02-22 28 * drm_gem_plane_helper_prepare_fb() can also be used directly as
820c1707177c6f Thomas Zimmermann 2021-02-22 29 * implementation of prepare_fb. For drivers based on
820c1707177c6f Thomas Zimmermann 2021-02-22 30 * struct drm_simple_display_pipe, drm_gem_simple_display_pipe_prepare_fb()
820c1707177c6f Thomas Zimmermann 2021-02-22 31 * provides equivalent functionality.
820c1707177c6f Thomas Zimmermann 2021-02-22 32 *
820c1707177c6f Thomas Zimmermann 2021-02-22 33 * .. code-block:: c
820c1707177c6f Thomas Zimmermann 2021-02-22 34 *
820c1707177c6f Thomas Zimmermann 2021-02-22 35 * #include <drm/drm_gem_atomic_helper.h>
820c1707177c6f Thomas Zimmermann 2021-02-22 36 *
820c1707177c6f Thomas Zimmermann 2021-02-22 37 * struct drm_plane_helper_funcs driver_plane_helper_funcs = {
820c1707177c6f Thomas Zimmermann 2021-02-22 38 * ...,
820c1707177c6f Thomas Zimmermann 2021-02-22 39 * . prepare_fb = drm_gem_plane_helper_prepare_fb,
820c1707177c6f Thomas Zimmermann 2021-02-22 40 * };
820c1707177c6f Thomas Zimmermann 2021-02-22 41 *
820c1707177c6f Thomas Zimmermann 2021-02-22 42 * struct drm_simple_display_pipe_funcs driver_pipe_funcs = {
820c1707177c6f Thomas Zimmermann 2021-02-22 43 * ...,
820c1707177c6f Thomas Zimmermann 2021-02-22 44 * . prepare_fb = drm_gem_simple_display_pipe_prepare_fb,
820c1707177c6f Thomas Zimmermann 2021-02-22 45 * };
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 46 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 47 * A driver using a shadow buffer copies the content of the shadow buffers
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 48 * into the HW's framebuffer memory during an atomic update. This requires
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 49 * a mapping of the shadow buffer into kernel address space. The mappings
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 50 * cannot be established by commit-tail functions, such as atomic_update,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 51 * as this would violate locking rules around dma_buf_vmap().
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 52 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 53 * The helpers for shadow-buffered planes establish and release mappings,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 54 * and provide struct drm_shadow_plane_state, which stores the plane's mapping
0ae865ef92f192 Cai Huoqing 2021-07-30 55 * for commit-tail functions.
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 56 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 57 * Shadow-buffered planes can easily be enabled by using the provided macros
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 58 * %DRM_GEM_SHADOW_PLANE_FUNCS and %DRM_GEM_SHADOW_PLANE_HELPER_FUNCS.
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 59 * These macros set up the plane and plane-helper callbacks to point to the
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 60 * shadow-buffer helpers.
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 61 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 62 * .. code-block:: c
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 63 *
820c1707177c6f Thomas Zimmermann 2021-02-22 64 * #include <drm/drm_gem_atomic_helper.h>
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 65 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 66 * struct drm_plane_funcs driver_plane_funcs = {
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 67 * ...,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 68 * DRM_GEM_SHADOW_PLANE_FUNCS,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 69 * };
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 70 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 71 * struct drm_plane_helper_funcs driver_plane_helper_funcs = {
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 72 * ...,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 73 * DRM_GEM_SHADOW_PLANE_HELPER_FUNCS,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 74 * };
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 75 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 76 * In the driver's atomic-update function, shadow-buffer mappings are available
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 77 * from the plane state. Use to_drm_shadow_plane_state() to upcast from
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 78 * struct drm_plane_state.
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 79 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 80 * .. code-block:: c
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 81 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 82 * void driver_plane_atomic_update(struct drm_plane *plane,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 83 * struct drm_plane_state *old_plane_state)
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 84 * {
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 85 * struct drm_plane_state *plane_state = plane->state;
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 86 * struct drm_shadow_plane_state *shadow_plane_state =
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 87 * to_drm_shadow_plane_state(plane_state);
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 88 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 89 * // access shadow buffer via shadow_plane_state->map
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 90 * }
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 91 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 92 * A mapping address for each of the framebuffer's buffer object is stored in
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 93 * struct &drm_shadow_plane_state.map. The mappings are valid while the state
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 94 * is being used.
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 95 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 96 * Drivers that use struct drm_simple_display_pipe can use
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 97 * %DRM_GEM_SIMPLE_DISPLAY_PIPE_SHADOW_PLANE_FUNCS to initialize the rsp
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 98 * callbacks. Access to shadow-buffer mappings is similar to regular
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 99 * atomic_update.
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 100 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 101 * .. code-block:: c
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 102 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 103 * struct drm_simple_display_pipe_funcs driver_pipe_funcs = {
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 104 * ...,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 105 * DRM_GEM_SIMPLE_DISPLAY_PIPE_SHADOW_PLANE_FUNCS,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 106 * };
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 107 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 108 * void driver_pipe_enable(struct drm_simple_display_pipe *pipe,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 109 * struct drm_crtc_state *crtc_state,
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 110 * struct drm_plane_state *plane_state)
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 111 * {
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 112 * struct drm_shadow_plane_state *shadow_plane_state =
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 113 * to_drm_shadow_plane_state(plane_state);
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 114 *
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 115 * // access shadow buffer via shadow_plane_state->map
9dc9067dce20b2 Thomas Zimmermann 2021-02-09 116 * }
6dd7b6ce43acd7 Thomas Zimmermann 2021-02-08 117 */
6dd7b6ce43acd7 Thomas Zimmermann 2021-02-08 118
820c1707177c6f Thomas Zimmermann 2021-02-22 119 /*
820c1707177c6f Thomas Zimmermann 2021-02-22 120 * Plane Helpers
820c1707177c6f Thomas Zimmermann 2021-02-22 121 */
820c1707177c6f Thomas Zimmermann 2021-02-22 122
820c1707177c6f Thomas Zimmermann 2021-02-22 123 /**
820c1707177c6f Thomas Zimmermann 2021-02-22 124 * drm_gem_plane_helper_prepare_fb() - Prepare a GEM backed framebuffer
820c1707177c6f Thomas Zimmermann 2021-02-22 125 * @plane: Plane
820c1707177c6f Thomas Zimmermann 2021-02-22 126 * @state: Plane state the fence will be attached to
820c1707177c6f Thomas Zimmermann 2021-02-22 127 *
820c1707177c6f Thomas Zimmermann 2021-02-22 128 * This function extracts the exclusive fence from &drm_gem_object.resv and
820c1707177c6f Thomas Zimmermann 2021-02-22 129 * attaches it to plane state for the atomic helper to wait on. This is
820c1707177c6f Thomas Zimmermann 2021-02-22 130 * necessary to correctly implement implicit synchronization for any buffers
820c1707177c6f Thomas Zimmermann 2021-02-22 131 * shared as a struct &dma_buf. This function can be used as the
820c1707177c6f Thomas Zimmermann 2021-02-22 132 * &drm_plane_helper_funcs.prepare_fb callback.
820c1707177c6f Thomas Zimmermann 2021-02-22 133 *
820c1707177c6f Thomas Zimmermann 2021-02-22 134 * There is no need for &drm_plane_helper_funcs.cleanup_fb hook for simple
820c1707177c6f Thomas Zimmermann 2021-02-22 135 * GEM based framebuffer drivers which have their buffers always pinned in
820c1707177c6f Thomas Zimmermann 2021-02-22 136 * memory.
820c1707177c6f Thomas Zimmermann 2021-02-22 137 *
7d30963fd191b7 Daniel Vetter 2021-06-23 138 * This function is the default implementation for GEM drivers of
7d30963fd191b7 Daniel Vetter 2021-06-23 139 * &drm_plane_helper_funcs.prepare_fb if no callback is provided.
7d30963fd191b7 Daniel Vetter 2021-06-23 140 *
820c1707177c6f Thomas Zimmermann 2021-02-22 141 * See drm_atomic_set_fence_for_plane() for a discussion of implicit and
820c1707177c6f Thomas Zimmermann 2021-02-22 142 * explicit fencing in atomic modeset updates.
820c1707177c6f Thomas Zimmermann 2021-02-22 143 */
820c1707177c6f Thomas Zimmermann 2021-02-22 144 int drm_gem_plane_helper_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state)
820c1707177c6f Thomas Zimmermann 2021-02-22 145 {
525bbf72dbe000 Christian König 2021-09-13 146 struct dma_resv_iter cursor;
820c1707177c6f Thomas Zimmermann 2021-02-22 147 struct drm_gem_object *obj;
820c1707177c6f Thomas Zimmermann 2021-02-22 148 struct dma_fence *fence;
820c1707177c6f Thomas Zimmermann 2021-02-22 149
820c1707177c6f Thomas Zimmermann 2021-02-22 150 if (!state->fb)
820c1707177c6f Thomas Zimmermann 2021-02-22 151 return 0;
820c1707177c6f Thomas Zimmermann 2021-02-22 152
820c1707177c6f Thomas Zimmermann 2021-02-22 153 obj = drm_gem_fb_get_obj(state->fb, 0);
525bbf72dbe000 Christian König 2021-09-13 154 dma_resv_iter_begin(&cursor, obj->resv, false);
525bbf72dbe000 Christian König 2021-09-13 @155 dma_resv_for_each_fence_unlocked(&cursor, fence) {
525bbf72dbe000 Christian König 2021-09-13 156 /* TODO: Currently there should be only one write fence, so this
525bbf72dbe000 Christian König 2021-09-13 157 * here works fine. But drm_atomic_set_fence_for_plane() should
525bbf72dbe000 Christian König 2021-09-13 158 * be changed to be able to handle more fences in general for
525bbf72dbe000 Christian König 2021-09-13 159 * multiple BOs per fb anyway. */
525bbf72dbe000 Christian König 2021-09-13 160 dma_fence_get(fence);
525bbf72dbe000 Christian König 2021-09-13 161 break;
525bbf72dbe000 Christian König 2021-09-13 162 }
525bbf72dbe000 Christian König 2021-09-13 163 dma_resv_iter_end(&cursor);
820c1707177c6f Thomas Zimmermann 2021-02-22 164
525bbf72dbe000 Christian König 2021-09-13 165 drm_atomic_set_fence_for_plane(state, fence);
820c1707177c6f Thomas Zimmermann 2021-02-22 166 return 0;
820c1707177c6f Thomas Zimmermann 2021-02-22 167 }
820c1707177c6f Thomas Zimmermann 2021-02-22 168 EXPORT_SYMBOL_GPL(drm_gem_plane_helper_prepare_fb);
820c1707177c6f Thomas Zimmermann 2021-02-22 169
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[toke:xdp_multi_buff_devel 7/27] net/core/xdp.c:562 __xdp_build_skb_from_frame() error: uninitialized symbol 'nr_frags'.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Lorenzo Bianconi <lorenzo(a)kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git xdp_multi_buff_devel
head: 72f04dae7aea860caadba6f54240a480f4634ef5
commit: 3263ecc2857198d9afdab6b5f7463ecce6931c32 [7/27] net: xdp: add xdp_update_skb_shared_info utility routine
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-m001-20211027 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
net/core/xdp.c:562 __xdp_build_skb_from_frame() error: uninitialized symbol 'nr_frags'.
vim +/nr_frags +562 net/core/xdp.c
65e6dcf73398dd Lorenzo Bianconi 2021-01-29 529
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 530 struct sk_buff *__xdp_build_skb_from_frame(struct xdp_frame *xdpf,
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 531 struct sk_buff *skb,
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 532 struct net_device *dev)
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 533 {
3263ecc2857198 Lorenzo Bianconi 2020-09-28 534 struct skb_shared_info *sinfo = xdp_get_shared_info_from_frame(xdpf);
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 535 unsigned int headroom, frame_size;
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 536 void *hard_start;
3263ecc2857198 Lorenzo Bianconi 2020-09-28 537 u8 nr_frags;
3263ecc2857198 Lorenzo Bianconi 2020-09-28 538
3263ecc2857198 Lorenzo Bianconi 2020-09-28 539 /* xdp multi-buff frame */
3263ecc2857198 Lorenzo Bianconi 2020-09-28 540 if (unlikely(xdp_frame_is_mb(xdpf)))
3263ecc2857198 Lorenzo Bianconi 2020-09-28 541 nr_frags = sinfo->nr_frags;
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 542
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 543 /* Part of headroom was reserved to xdpf */
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 544 headroom = sizeof(*xdpf) + xdpf->headroom;
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 545
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 546 /* Memory size backing xdp_frame data already have reserved
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 547 * room for build_skb to place skb_shared_info in tailroom.
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 548 */
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 549 frame_size = xdpf->frame_sz;
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 550
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 551 hard_start = xdpf->data - headroom;
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 552 skb = build_skb_around(skb, hard_start, frame_size);
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 553 if (unlikely(!skb))
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 554 return NULL;
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 555
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 556 skb_reserve(skb, headroom);
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 557 __skb_put(skb, xdpf->len);
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 558 if (xdpf->metasize)
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 559 skb_metadata_set(skb, xdpf->metasize);
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 560
3263ecc2857198 Lorenzo Bianconi 2020-09-28 561 if (unlikely(xdp_frame_is_mb(xdpf)))
3263ecc2857198 Lorenzo Bianconi 2020-09-28 @562 xdp_update_skb_shared_info(skb, nr_frags,
3263ecc2857198 Lorenzo Bianconi 2020-09-28 563 sinfo->xdp_frags_size,
3263ecc2857198 Lorenzo Bianconi 2020-09-28 564 nr_frags * xdpf->frame_sz,
3263ecc2857198 Lorenzo Bianconi 2020-09-28 565 xdp_frame_is_frag_pfmemalloc(xdpf));
3263ecc2857198 Lorenzo Bianconi 2020-09-28 566
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 567 /* Essential SKB info: protocol and skb->dev */
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 568 skb->protocol = eth_type_trans(skb, dev);
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 569
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 570 /* Optional SKB info, currently missing:
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 571 * - HW checksum info (skb->ip_summed)
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 572 * - HW RX hash (skb_set_hash)
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 573 * - RX ring dev queue index (skb_record_rx_queue)
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 574 */
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 575
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 576 /* Until page_pool get SKB return path, release DMA here */
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 577 xdp_release_frame(xdpf);
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 578
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 579 /* Allow SKB to reuse area used by xdp_frame */
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 580 xdp_scrub_frame(xdpf);
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 581
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 582 return skb;
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 583 }
97a0e1ea7b41c2 Lorenzo Bianconi 2021-01-12 584 EXPORT_SYMBOL_GPL(__xdp_build_skb_from_frame);
89f479f0eccfc8 Lorenzo Bianconi 2021-01-12 585
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[linux-next:master 2951/11937] sound/soc/codecs/wm_adsp.c:1441 wm_adsp_control_add() error: uninitialized symbol 'ret'.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: Simon Trimmer <simont(a)opensource.cirrus.com>
CC: Mark Brown <broonie(a)kernel.org>
CC: Charles Keepax <ckeepax(a)opensource.cirrus.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: ae5179317e794160e471db0e122c6ac811a97235
commit: 0700bc2fb94c28459f57a10d2ee2c7ef4cb70862 [2951/11937] ASoC: wm_adsp: Separate generic cs_dsp_coeff_ctl handling
:::::: branch date: 6 hours ago
:::::: commit date: 4 weeks ago
config: riscv-randconfig-m031-20211027 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
sound/soc/codecs/wm_adsp.c:1441 wm_adsp_control_add() error: uninitialized symbol 'ret'.
Old smatch warnings:
sound/soc/codecs/wm_adsp.c:2274 cs_dsp_create_regions() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2309 cs_dsp_adsp1_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2314 cs_dsp_adsp1_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2337 cs_dsp_adsp1_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2358 cs_dsp_adsp1_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2410 cs_dsp_adsp2_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2415 cs_dsp_adsp2_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2420 cs_dsp_adsp2_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2445 cs_dsp_adsp2_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2466 cs_dsp_adsp2_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
sound/soc/codecs/wm_adsp.c:2487 cs_dsp_adsp2_setup_algs() warn: passing a valid pointer to 'PTR_ERR'
vim +/ret +1441 sound/soc/codecs/wm_adsp.c
66225e98b98504 Richard Fitzgerald 2016-04-27 1404
0700bc2fb94c28 Simon Trimmer 2021-09-13 1405 static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
b21acc1c370f72 Charles Keepax 2015-04-13 1406 {
0700bc2fb94c28 Simon Trimmer 2021-09-13 1407 struct wm_adsp *dsp = cs_ctl->dsp;
b21acc1c370f72 Charles Keepax 2015-04-13 1408 struct wm_coeff_ctl *ctl;
b21acc1c370f72 Charles Keepax 2015-04-13 1409 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
9ce5e6e61122cd Richard Fitzgerald 2016-11-09 1410 const char *region_name;
b21acc1c370f72 Charles Keepax 2015-04-13 1411 int ret;
b21acc1c370f72 Charles Keepax 2015-04-13 1412
0700bc2fb94c28 Simon Trimmer 2021-09-13 1413 if (cs_ctl->flags & WMFW_CTL_FLAG_SYS)
6477960755fb2c Charles Keepax 2021-09-13 1414 return 0;
6477960755fb2c Charles Keepax 2021-09-13 1415
0700bc2fb94c28 Simon Trimmer 2021-09-13 1416 region_name = cs_dsp_mem_region_name(cs_ctl->alg_region.type);
9ce5e6e61122cd Richard Fitzgerald 2016-11-09 1417 if (!region_name) {
0700bc2fb94c28 Simon Trimmer 2021-09-13 1418 adsp_err(dsp, "Unknown region type: %d\n", cs_ctl->alg_region.type);
b21acc1c370f72 Charles Keepax 2015-04-13 1419 return -EINVAL;
b21acc1c370f72 Charles Keepax 2015-04-13 1420 }
b21acc1c370f72 Charles Keepax 2015-04-13 1421
cb5b57a9a449ad Charles Keepax 2015-04-13 1422 switch (dsp->fw_ver) {
cb5b57a9a449ad Charles Keepax 2015-04-13 1423 case 0:
cb5b57a9a449ad Charles Keepax 2015-04-13 1424 case 1:
605391d0f4bfdf Richard Fitzgerald 2018-08-08 1425 snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s %s %x",
0700bc2fb94c28 Simon Trimmer 2021-09-13 1426 dsp->name, region_name, cs_ctl->alg_region.alg);
cb5b57a9a449ad Charles Keepax 2015-04-13 1427 break;
170b1e123f385e Wen Shi 2019-03-19 1428 case 2:
578194290d0bf8 Takashi Iwai 2020-03-13 1429 ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
605391d0f4bfdf Richard Fitzgerald 2018-08-08 1430 "%s%c %.12s %x", dsp->name, *region_name,
0700bc2fb94c28 Simon Trimmer 2021-09-13 1431 wm_adsp_fw_text[dsp->fw], cs_ctl->alg_region.alg);
170b1e123f385e Wen Shi 2019-03-19 1432 break;
170b1e123f385e Wen Shi 2019-03-19 1433 default:
578194290d0bf8 Takashi Iwai 2020-03-13 1434 ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
170b1e123f385e Wen Shi 2019-03-19 1435 "%s %.12s %x", dsp->name,
0700bc2fb94c28 Simon Trimmer 2021-09-13 1436 wm_adsp_fw_text[dsp->fw], cs_ctl->alg_region.alg);
170b1e123f385e Wen Shi 2019-03-19 1437 break;
170b1e123f385e Wen Shi 2019-03-19 1438 }
cb5b57a9a449ad Charles Keepax 2015-04-13 1439
0700bc2fb94c28 Simon Trimmer 2021-09-13 1440 if (cs_ctl->subname) {
cb5b57a9a449ad Charles Keepax 2015-04-13 @1441 int avail = SNDRV_CTL_ELEM_ID_NAME_MAXLEN - ret - 2;
cb5b57a9a449ad Charles Keepax 2015-04-13 1442 int skip = 0;
cb5b57a9a449ad Charles Keepax 2015-04-13 1443
b7ede5af62ab6b Charles Keepax 2018-07-19 1444 if (dsp->component->name_prefix)
b7ede5af62ab6b Charles Keepax 2018-07-19 1445 avail -= strlen(dsp->component->name_prefix) + 1;
b7ede5af62ab6b Charles Keepax 2018-07-19 1446
170b1e123f385e Wen Shi 2019-03-19 1447 /* Truncate the subname from the start if it is too long */
0700bc2fb94c28 Simon Trimmer 2021-09-13 1448 if (cs_ctl->subname_len > avail)
0700bc2fb94c28 Simon Trimmer 2021-09-13 1449 skip = cs_ctl->subname_len - avail;
cb5b57a9a449ad Charles Keepax 2015-04-13 1450
170b1e123f385e Wen Shi 2019-03-19 1451 snprintf(name + ret, SNDRV_CTL_ELEM_ID_NAME_MAXLEN - ret,
0700bc2fb94c28 Simon Trimmer 2021-09-13 1452 " %.*s", cs_ctl->subname_len - skip, cs_ctl->subname + skip);
cb5b57a9a449ad Charles Keepax 2015-04-13 1453 }
b21acc1c370f72 Charles Keepax 2015-04-13 1454
b21acc1c370f72 Charles Keepax 2015-04-13 1455 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
b21acc1c370f72 Charles Keepax 2015-04-13 1456 if (!ctl)
b21acc1c370f72 Charles Keepax 2015-04-13 1457 return -ENOMEM;
0700bc2fb94c28 Simon Trimmer 2021-09-13 1458 ctl->cs_ctl = cs_ctl;
0700bc2fb94c28 Simon Trimmer 2021-09-13 1459
b21acc1c370f72 Charles Keepax 2015-04-13 1460 ctl->name = kmemdup(name, strlen(name) + 1, GFP_KERNEL);
b21acc1c370f72 Charles Keepax 2015-04-13 1461 if (!ctl->name) {
b21acc1c370f72 Charles Keepax 2015-04-13 1462 ret = -ENOMEM;
b21acc1c370f72 Charles Keepax 2015-04-13 1463 goto err_ctl;
b21acc1c370f72 Charles Keepax 2015-04-13 1464 }
0700bc2fb94c28 Simon Trimmer 2021-09-13 1465
0700bc2fb94c28 Simon Trimmer 2021-09-13 1466 cs_ctl->priv = ctl;
0700bc2fb94c28 Simon Trimmer 2021-09-13 1467
0700bc2fb94c28 Simon Trimmer 2021-09-13 1468 INIT_WORK(&ctl->work, wm_adsp_ctl_work);
0700bc2fb94c28 Simon Trimmer 2021-09-13 1469 schedule_work(&ctl->work);
0700bc2fb94c28 Simon Trimmer 2021-09-13 1470
0700bc2fb94c28 Simon Trimmer 2021-09-13 1471 return 0;
0700bc2fb94c28 Simon Trimmer 2021-09-13 1472
0700bc2fb94c28 Simon Trimmer 2021-09-13 1473 err_ctl:
0700bc2fb94c28 Simon Trimmer 2021-09-13 1474 kfree(ctl);
0700bc2fb94c28 Simon Trimmer 2021-09-13 1475
0700bc2fb94c28 Simon Trimmer 2021-09-13 1476 return ret;
0700bc2fb94c28 Simon Trimmer 2021-09-13 1477 }
0700bc2fb94c28 Simon Trimmer 2021-09-13 1478
:::::: The code at line 1441 was first introduced by commit
:::::: cb5b57a9a449adc7047b709adf25e489785f0bb4 ASoC: wm_adsp: Add support for rev 2 firmware file format
:::::: TO: Charles Keepax <ckeepax(a)opensource.wolfsonmicro.com>
:::::: CC: Mark Brown <broonie(a)kernel.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks