Linux NFS development
 help / color / mirror / Atom feed
* [bug report] NFS: Convert to the netfs API and nfs_readpage to use netfs_readpage
@ 2021-02-02  5:48 Dan Carpenter
  2021-02-02 12:23 ` David Wysochanski
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-02-02  5:48 UTC (permalink / raw)
  To: dwysocha; +Cc: linux-nfs

Hello Dave Wysochanski,

This is a semi-automatic email about new static checker warnings.

The patch bc6d7b12e4ea: "NFS: Convert to the netfs API and
nfs_readpage to use netfs_readpage" from Nov 14, 2020, leads to the
following Smatch complaint:

    fs/nfs/read.c:365 nfs_readpage()
    error: we previously assumed 'file' could be null (see line 356)

fs/nfs/read.c
   355	
   356		if (file == NULL) {
                    ^^^^^^^^^^^^
"file" is NULL here

   357			ret = -EBADF;
   358			desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
   359			if (desc.ctx == NULL)
   360				goto out_unlock;
   361		} else
   362			desc.ctx = get_nfs_open_context(nfs_file_open_context(file));
   363	
   364		if (!IS_SYNC(inode)) {
   365			ret = nfs_readpage_from_fscache(file, page, &desc);
                                                        ^^^^
Unchecked dereference inside function call.

   366			if (ret == 0)
   367				goto out;

regards,
dan carpenter

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

* Re: [bug report] NFS: Convert to the netfs API and nfs_readpage to use netfs_readpage
  2021-02-02  5:48 [bug report] NFS: Convert to the netfs API and nfs_readpage to use netfs_readpage Dan Carpenter
@ 2021-02-02 12:23 ` David Wysochanski
  0 siblings, 0 replies; 2+ messages in thread
From: David Wysochanski @ 2021-02-02 12:23 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-nfs

On Tue, Feb 2, 2021 at 12:48 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Hello Dave Wysochanski,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch bc6d7b12e4ea: "NFS: Convert to the netfs API and
> nfs_readpage to use netfs_readpage" from Nov 14, 2020, leads to the
> following Smatch complaint:
>
>     fs/nfs/read.c:365 nfs_readpage()
>     error: we previously assumed 'file' could be null (see line 356)
>
> fs/nfs/read.c
>    355
>    356          if (file == NULL) {
>                     ^^^^^^^^^^^^
> "file" is NULL here
>
>    357                  ret = -EBADF;
>    358                  desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
>    359                  if (desc.ctx == NULL)
>    360                          goto out_unlock;
>    361          } else
>    362                  desc.ctx = get_nfs_open_context(nfs_file_open_context(file));
>    363
>    364          if (!IS_SYNC(inode)) {
>    365                  ret = nfs_readpage_from_fscache(file, page, &desc);
>                                                         ^^^^
> Unchecked dereference inside function call.
>

Thanks for flagging this.

I confess I don't understand why we could get file == NULL in
nfs_readpage() but I'm looking into it.


>    366                  if (ret == 0)
>    367                          goto out;
>
> regards,
> dan carpenter
>


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

end of thread, other threads:[~2021-02-02 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-02  5:48 [bug report] NFS: Convert to the netfs API and nfs_readpage to use netfs_readpage Dan Carpenter
2021-02-02 12:23 ` David Wysochanski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox