All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [bug report] Handle mismatched open calls
Date: Thu, 06 Apr 2017 11:07:07 +0100	[thread overview]
Message-ID: <1491473227.3042.2.camel@redhat.com> (raw)
In-Reply-To: <20170406091021.GA28584@mwanda>

On Thu, 2017-04-06 at 12:11 +0300, Dan Carpenter wrote:
> Hello Sachin Prabhu,
> 
> The patch 96b75d0508f8: "Handle mismatched open calls" from Mar 3,
> 2017, leads to the following static checker warning:
> 
> 	fs/cifs/cifssmb.c:1530 cifs_readv_receive()
> 	error: potential NULL dereference 'server->smallbuf'.
> 
> fs/cifs/cifssmb.c
>   1519          cifs_dbg(FYI, "0: iov_base=%p iov_len=%u\n",
>   1520                   rdata->iov[0].iov_base, server->total_read);
>   1521  
>   1522          mid->resp_buf = server->smallbuf;
>   1523          server->smallbuf = NULL;
>                 ^^^^^^^^^^^^^^^^^^^^^^^
> We set this to NULL here
> 
>   1524  
>   1525          /* how much data is in the response? */
>   1526          data_len = server->ops->read_data_length(buf);
>   1527          if (data_offset + data_len > buflen) {
>   1528                  /* data_len is corrupt -- discard frame */
>   1529                  rdata->result = -EIO;
>   1530                  return cifs_readv_discard(server, mid);
>                                                   ^^^^^^
> but we need it here.
> 
>   1531          }
>   1532  
>   1533          length = rdata->read_into_pages(server, rdata,
> data_len);
>   1534          if (length < 0)
>   1535                  return length;
> 
> regards,
> dan carpenter

Thanks Dan,

We should probably move that piece of code to the bottom of the
function just before we return.

Sachin Prabhu

  reply	other threads:[~2017-04-06 10:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06  9:11 [bug report] Handle mismatched open calls Dan Carpenter
2017-04-06 10:07 ` Sachin Prabhu [this message]
     [not found]   ` <1491473227.3042.2.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-06 18:24     ` Sachin Prabhu
     [not found]       ` <1491503047.8010.2.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-07  1:28         ` Steve French
2017-04-07  8:20         ` Dan Carpenter
2017-04-07 12:18           ` Sachin Prabhu
     [not found]             ` <1491567538.8010.6.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-07 13:05               ` Steve French
     [not found]                 ` <CAH2r5muHaA0JJ7E6fLFxO69wvLtuep8pC8_GdSsM_Lj2drYQOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-07 13:18                   ` Steve French

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=1491473227.3042.2.camel@redhat.com \
    --to=sprabhu-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.