linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] cifsd: introduce SMB3 kernel server
@ 2021-03-18 13:12 Dan Carpenter
       [not found] ` <CAH2r5msOBAho=1W-eY0paj+4P1J+tuw-vFaRGg8oY50dXu6MHQ@mail.gmail.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dan Carpenter @ 2021-03-18 13:12 UTC (permalink / raw)
  To: namjae.jeon; +Cc: linux-cifs

[ 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-04-06 23:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 13:12 [bug report] cifsd: introduce SMB3 kernel server Dan Carpenter
     [not found] ` <CAH2r5msOBAho=1W-eY0paj+4P1J+tuw-vFaRGg8oY50dXu6MHQ@mail.gmail.com>
2021-03-19  8:11   ` 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

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).