linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: namjae.jeon@samsung.com
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] cifsd: introduce SMB3 kernel server
Date: Thu, 18 Mar 2021 16:12:17 +0300	[thread overview]
Message-ID: <YFNRsYSWw77UMxw1@mwanda> (raw)

[ The fs/cifsd/ directory needs to be added to the MAINTAINERS file
  so this stuff goes through linux-cifs@vger.kernel.org ]

Hello Namjae Jeon,

The patch cabcebc31de4: "cifsd: introduce SMB3 kernel server" from
May 14, 2020, leads to the following static checker warning:

	fs/cifsd/transport_rdma.c:1168 smb_direct_post_send_data()
	warn: missing error code 'ret'

fs/cifsd/transport_rdma.c
  1150  
  1151          ret = smb_direct_create_header(t, data_length, remaining_data_length,
  1152                                         &msg);
  1153          if (ret) {
  1154                  atomic_inc(&t->send_credits);
  1155                  return ret;
  1156          }

"ret" is zero.

  1157  
  1158          for (i = 0; i < niov; i++) {
  1159                  struct ib_sge *sge;
  1160                  int sg_cnt;
  1161  
  1162                  sg_init_table(sg, SMB_DIRECT_MAX_SEND_SGES-1);
  1163                  sg_cnt = get_mapped_sg_list(t->cm_id->device,
  1164                                  iov[i].iov_base, iov[i].iov_len,
  1165                                  sg, SMB_DIRECT_MAX_SEND_SGES-1, DMA_TO_DEVICE);
  1166                  if (sg_cnt <= 0) {
  1167                          ksmbd_err("failed to map buffer\n");
  1168                          goto err;

Should ret = -ENOMEM on this path?

  1169                  } else if (sg_cnt + msg->num_sge > SMB_DIRECT_MAX_SEND_SGES-1) {
  1170                          ksmbd_err("buffer not fitted into sges\n");
  1171                          ret = -E2BIG;
  1172                          ib_dma_unmap_sg(t->cm_id->device, sg, sg_cnt,
  1173                                          DMA_TO_DEVICE);
  1174                          goto err;
  1175                  }
  1176  
  1177                  for (j = 0; j < sg_cnt; j++) {
  1178                          sge = &msg->sge[msg->num_sge];
  1179                          sge->addr = sg_dma_address(&sg[j]);
  1180                          sge->length = sg_dma_len(&sg[j]);
  1181                          sge->lkey  = t->pd->local_dma_lkey;
  1182                          msg->num_sge++;
  1183                  }
  1184          }
  1185  
  1186          ret = post_sendmsg(t, send_ctx, msg);
  1187          if (ret)
  1188                  goto err;
  1189          return 0;
  1190  err:
  1191          smb_direct_free_sendmsg(t, msg);
  1192          atomic_inc(&t->send_credits);
  1193          return ret;
  1194  }

regards,
dan carpenter

             reply	other threads:[~2021-03-18 13:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 13:12 Dan Carpenter [this message]
     [not found] ` <CAH2r5msOBAho=1W-eY0paj+4P1J+tuw-vFaRGg8oY50dXu6MHQ@mail.gmail.com>
2021-03-19  8:11   ` [bug report] cifsd: introduce SMB3 kernel server Dan Carpenter
2021-03-19 13:12 ` Christoph Hellwig
2021-03-19 15:07   ` Steve French
2021-03-19 15:21     ` Christoph Hellwig
2021-03-19 15:27       ` Steve French
2021-04-06  8:37 ` L. A. Walsh
2021-04-06 10:14   ` Aurélien Aptel
2021-04-06 22:55     ` cifsd: introduce <SMB2n3> " L. A. Walsh
2021-04-06 23:32       ` Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YFNRsYSWw77UMxw1@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).