[bug report] CIFS: Add support for direct I/O write

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

 



Hello Long Li,

The patch 8c5f9c1ab7cb: "CIFS: Add support for direct I/O write" from
Oct 31, 2018, leads to the following static checker warning:

	fs/cifs/file.c:2568 cifs_resend_wdata()
	error: uninitialized symbol 'wsize'.

fs/cifs/file.c
  2541  static int
  2542  cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list,
  2543          struct cifs_aio_ctx *ctx)
  2544  {
  2545          int wait_retry = 0;
  2546          unsigned int wsize, credits;
  2547          int rc;
  2548          struct TCP_Server_Info *server =
  2549                  tlink_tcon(wdata->cfile->tlink)->ses->server;
  2550  
  2551          /*
  2552           * Try to resend this wdata, waiting for credits up to 3 seconds.
  2553           * Note: we are attempting to resend the whole wdata not in segments
  2554           */
  2555          do {
  2556                  rc = server->ops->wait_mtu_credits(
  2557                          server, wdata->bytes, &wsize, &credits);

The smb2_wait_mtu_credits() function can return an error without
initializing wsize.

  2558  
  2559                  if (rc)
  2560                          break;
                                ^^^^^
  2561  
  2562                  if (wsize < wdata->bytes) {
  2563                          add_credits_and_wake_if(server, credits, 0);
  2564                          msleep(1000);
  2565                          wait_retry++;
  2566                  }
  2567          } while (wsize < wdata->bytes && wait_retry < 3);
  2568  
  2569          if (wsize < wdata->bytes) {
                    ^^^^^^^^^^^^^^^^^^^^

  2570                  rc = -EBUSY;
  2571                  goto out;
  2572          }
  2573  

Maybe initialize wsize = 0 or change the break to a goto out?

regards,
dan carpenter



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux