CC: kbuild-...@lists.01.org
BCC: l...@intel.com
CC: "GNU/Weeb Mailing List" <g...@vger.gnuweeb.org>
CC: linux-ker...@vger.kernel.org
TO: David Howells <dhowe...@redhat.com>

tree:   https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-maple
head:   674eea41fc70a740ff83ec590f9833f805852464
commit: 86ffcdd2a1cb7c858063208fdfb7abe941bc0b9e [28/40] netfs: Support 
decryption on DIO read
:::::: branch date: 18 hours ago
:::::: commit date: 19 hours ago
config: x86_64-randconfig-m001 
(https://download.01.org/0day-ci/archive/20220405/202204051815.gb2c37hk-...@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@oracle.com>

smatch warnings:
fs/netfs/direct_read.c:193 netfs_direct_read_iter() warn: statement has no 
effect 3

vim +193 fs/netfs/direct_read.c

be1bb787e99ec1 David Howells 2022-01-14  111  
be1bb787e99ec1 David Howells 2022-01-14  112  /**
be1bb787e99ec1 David Howells 2022-01-14  113   * netfs_direct_read_iter - 
Perform a direct I/O read
be1bb787e99ec1 David Howells 2022-01-14  114   * @iocb: The I/O control 
descriptor describing the read
be1bb787e99ec1 David Howells 2022-01-14  115   * @iter: The output buffer (also 
specifies read length)
be1bb787e99ec1 David Howells 2022-01-14  116   */
be1bb787e99ec1 David Howells 2022-01-14  117  ssize_t 
netfs_direct_read_iter(struct kiocb *iocb, struct iov_iter *iter)
be1bb787e99ec1 David Howells 2022-01-14  118  {
be1bb787e99ec1 David Howells 2022-01-14  119    struct netfs_io_request *rreq;
86ffcdd2a1cb7c David Howells 2022-02-17  120    struct netfs_i_context *ctx;
86ffcdd2a1cb7c David Howells 2022-02-17  121    ssize_t n, ret;
be1bb787e99ec1 David Howells 2022-01-14  122  
be1bb787e99ec1 David Howells 2022-01-14  123    _enter("");
be1bb787e99ec1 David Howells 2022-01-14  124  
be1bb787e99ec1 David Howells 2022-01-14  125    rreq = 
netfs_alloc_request(iocb->ki_filp->f_mapping, iocb->ki_filp,
be1bb787e99ec1 David Howells 2022-01-14  126                               
iocb->ki_pos, iov_iter_count(iter),
be1bb787e99ec1 David Howells 2022-01-14  127                               
NETFS_DIO_READ);
be1bb787e99ec1 David Howells 2022-01-14  128    if (IS_ERR(rreq))
be1bb787e99ec1 David Howells 2022-01-14  129            return PTR_ERR(rreq);
be1bb787e99ec1 David Howells 2022-01-14  130  
86ffcdd2a1cb7c David Howells 2022-02-17  131    ctx = 
netfs_i_context(rreq->inode);
be1bb787e99ec1 David Howells 2022-01-14  132    
netfs_stat(&netfs_n_rh_dio_read);
be1bb787e99ec1 David Howells 2022-01-14  133    trace_netfs_read(rreq, 
rreq->start, rreq->len, netfs_read_trace_dio_read);
be1bb787e99ec1 David Howells 2022-01-14  134  
86ffcdd2a1cb7c David Howells 2022-02-17  135    rreq->buffering = NETFS_DIRECT;
86ffcdd2a1cb7c David Howells 2022-02-17  136    if 
(test_bit(NETFS_RREQ_CONTENT_ENCRYPTION, &rreq->flags)) {
86ffcdd2a1cb7c David Howells 2022-02-17  137            static const enum 
netfs_buffering buffering[2][2] = {
86ffcdd2a1cb7c David Howells 2022-02-17  138                    /* 
[async][aligned] */
86ffcdd2a1cb7c David Howells 2022-02-17  139                    [false][false]  
= NETFS_BOUNCE_DEC_COPY,
86ffcdd2a1cb7c David Howells 2022-02-17  140                    [false][true]   
= NETFS_BOUNCE_DEC_TO_DIRECT,
86ffcdd2a1cb7c David Howells 2022-02-17  141                    [true ][false]  
= NETFS_BOUNCE_DEC_COPY_BV,
86ffcdd2a1cb7c David Howells 2022-02-17  142                    [true ][true]   
= NETFS_BOUNCE_DEC_TO_DIRECT_BV,
86ffcdd2a1cb7c David Howells 2022-02-17  143            };
86ffcdd2a1cb7c David Howells 2022-02-17  144            bool aligned = 
netfs_is_crypto_aligned(rreq, iter);
86ffcdd2a1cb7c David Howells 2022-02-17  145            bool async = 
!is_sync_kiocb(iocb);
86ffcdd2a1cb7c David Howells 2022-02-17  146  
86ffcdd2a1cb7c David Howells 2022-02-17  147            rreq->buffering = 
buffering[async][aligned];
86ffcdd2a1cb7c David Howells 2022-02-17  148    }
86ffcdd2a1cb7c David Howells 2022-02-17  149  
86ffcdd2a1cb7c David Howells 2022-02-17  150    kdebug("remote_i %llx %llx 
%llx",
86ffcdd2a1cb7c David Howells 2022-02-17  151           ctx->remote_i_size, 
rreq->i_size, i_size_read(netfs_inode(ctx)));
be1bb787e99ec1 David Howells 2022-01-14  152  
be1bb787e99ec1 David Howells 2022-01-14  153    /* If this is an async op, we 
have to keep track of the destination
be1bb787e99ec1 David Howells 2022-01-14  154     * buffer for ourselves as the 
caller's iterator will be trashed when
be1bb787e99ec1 David Howells 2022-01-14  155     * we return.
be1bb787e99ec1 David Howells 2022-01-14  156     *
be1bb787e99ec1 David Howells 2022-01-14  157     * In such a case, extract an 
iterator to represent as much of the the
be1bb787e99ec1 David Howells 2022-01-14  158     * output buffer as we can 
manage.  Note that the extraction might not
be1bb787e99ec1 David Howells 2022-01-14  159     * be able to allocate a 
sufficiently large bvec array and may shorten
be1bb787e99ec1 David Howells 2022-01-14  160     * the request.
be1bb787e99ec1 David Howells 2022-01-14  161     */
be1bb787e99ec1 David Howells 2022-01-14  162    switch (rreq->buffering) {
be1bb787e99ec1 David Howells 2022-01-14  163    case NETFS_DIRECT:
86ffcdd2a1cb7c David Howells 2022-02-17  164    case NETFS_BOUNCE_DEC_TO_DIRECT:
86ffcdd2a1cb7c David Howells 2022-02-17  165    case NETFS_BOUNCE_DEC_COPY:
be1bb787e99ec1 David Howells 2022-01-14  166            rreq->direct_iter = 
*iter;
be1bb787e99ec1 David Howells 2022-01-14  167            rreq->len = 
iov_iter_count(&rreq->direct_iter);
be1bb787e99ec1 David Howells 2022-01-14  168            break;
be1bb787e99ec1 David Howells 2022-01-14  169    case NETFS_DIRECT_BV:
86ffcdd2a1cb7c David Howells 2022-02-17  170    case 
NETFS_BOUNCE_DEC_TO_DIRECT_BV:
86ffcdd2a1cb7c David Howells 2022-02-17  171    case NETFS_BOUNCE_DEC_COPY_BV:
be1bb787e99ec1 David Howells 2022-01-14  172            n = 
extract_iter_to_iter(iter, rreq->len, &rreq->direct_iter,
be1bb787e99ec1 David Howells 2022-01-14  173                                    
 &rreq->direct_bv);
be1bb787e99ec1 David Howells 2022-01-14  174            if (n < 0) {
86ffcdd2a1cb7c David Howells 2022-02-17  175                    ret = n;
86ffcdd2a1cb7c David Howells 2022-02-17  176                    goto out;
be1bb787e99ec1 David Howells 2022-01-14  177            }
be1bb787e99ec1 David Howells 2022-01-14  178            rreq->direct_bv_count = 
n;
be1bb787e99ec1 David Howells 2022-01-14  179            rreq->len = 
iov_iter_count(&rreq->direct_iter);
be1bb787e99ec1 David Howells 2022-01-14  180            break;
be1bb787e99ec1 David Howells 2022-01-14  181    default:
be1bb787e99ec1 David Howells 2022-01-14  182            BUG();
be1bb787e99ec1 David Howells 2022-01-14  183    }
be1bb787e99ec1 David Howells 2022-01-14  184  
86ffcdd2a1cb7c David Howells 2022-02-17  185    /* If we're going to use a 
bounce buffer, we need to set it up.  We
86ffcdd2a1cb7c David Howells 2022-02-17  186     * will then need to pad the 
request out to the minimum block size.
86ffcdd2a1cb7c David Howells 2022-02-17  187     */
86ffcdd2a1cb7c David Howells 2022-02-17  188    switch (rreq->buffering) {
86ffcdd2a1cb7c David Howells 2022-02-17  189    case NETFS_BOUNCE_DEC_TO_DIRECT:
86ffcdd2a1cb7c David Howells 2022-02-17  190    case NETFS_BOUNCE_DEC_COPY:
86ffcdd2a1cb7c David Howells 2022-02-17  191    case 
NETFS_BOUNCE_DEC_TO_DIRECT_BV:
86ffcdd2a1cb7c David Howells 2022-02-17  192    case NETFS_BOUNCE_DEC_COPY_BV:
86ffcdd2a1cb7c David Howells 2022-02-17 @193            unsigned int min_bsize 
= 1ULL << ctx->min_bshift;

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to