[bug report] block: bio-integrity: directly map user buffers

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

 



Hello Keith Busch,

The patch 492c5d455969: "block: bio-integrity: directly map user
buffers" from Nov 30, 2023 (linux-next), leads to the following
Smatch static checker warning:

	block/bio-integrity.c:350 bio_integrity_map_user()
	error: uninitialized symbol 'offset'.

block/bio-integrity.c
    340                 if (!bvec)
    341                         return -ENOMEM;
    342                 pages = NULL;
    343         }
    344 
    345         copy = !iov_iter_is_aligned(&iter, align, align);
    346         ret = iov_iter_extract_pages(&iter, &pages, bytes, nr_vecs, 0, &offset);

Smatch is concerned about the first "return 0;" if bytes or iter.count
is zero.  In that situation then offset is uninitialized.

    347         if (unlikely(ret < 0))
    348                 goto free_bvec;
    349 
--> 350         nr_bvecs = bvec_from_pages(bvec, pages, nr_vecs, bytes, offset);
                                                                        ^^^^^^

    351         if (pages != stack_pages)
    352                 kvfree(pages);
    353         if (nr_bvecs > queue_max_integrity_segments(q))
    354                 copy = true;
    355 
    356         if (copy)
    357                 ret = bio_integrity_copy_user(bio, bvec, nr_bvecs, bytes,
    358                                               direction, seed);
    359         else

regards,
dan carpenter




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux