From: Dan Carpenter <dan.carpenter@oracle.com>
To: ruansy.fnst@fujitsu.com
Cc: linux-fsdevel@vger.kernel.org
Subject: [bug report] fsdax: output address in dax_iomap_pfn() and rename it
Date: Tue, 7 Jun 2022 10:59:13 +0300 [thread overview]
Message-ID: <Yp8FUZnO64Qvyx5G@kili> (raw)
Hello Shiyang Ruan,
The patch 1447ac26a964: "fsdax: output address in dax_iomap_pfn() and
rename it" from Jun 3, 2022, leads to the following Smatch static
checker warning:
fs/dax.c:1085 dax_iomap_direct_access()
error: uninitialized symbol 'rc'.
fs/dax.c
1052 static int dax_iomap_direct_access(const struct iomap *iomap, loff_t pos,
1053 size_t size, void **kaddr, pfn_t *pfnp)
1054 {
1055 pgoff_t pgoff = dax_iomap_pgoff(iomap, pos);
1056 int id, rc;
1057 long length;
1058
1059 id = dax_read_lock();
1060 length = dax_direct_access(iomap->dax_dev, pgoff, PHYS_PFN(size),
1061 DAX_ACCESS, kaddr, pfnp);
1062 if (length < 0) {
1063 rc = length;
1064 goto out;
1065 }
1066 if (!pfnp)
1067 goto out_check_addr;
Is this an error path?
1068 rc = -EINVAL;
1069 if (PFN_PHYS(length) < size)
1070 goto out;
1071 if (pfn_t_to_pfn(*pfnp) & (PHYS_PFN(size)-1))
1072 goto out;
1073 /* For larger pages we need devmap */
1074 if (length > 1 && !pfn_t_devmap(*pfnp))
1075 goto out;
1076 rc = 0;
1077
1078 out_check_addr:
1079 if (!kaddr)
1080 goto out;
How is it supposed to be handled if both "pfnp" and "kaddr" are NULL?
Smatch says that "kaddr" can never be NULL so this code is just future
proofing but I didn't look at it carefully.
1081 if (!*kaddr)
1082 rc = -EFAULT;
1083 out:
1084 dax_read_unlock(id);
--> 1085 return rc;
1086 }
regards,
dan carpenter
next reply other threads:[~2022-06-07 7:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 7:59 Dan Carpenter [this message]
2022-06-07 8:54 ` [bug report] fsdax: output address in dax_iomap_pfn() and rename it Shiyang Ruan
2022-06-07 9:04 ` Dan Carpenter
2022-06-07 9:09 ` Shiyang Ruan
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=Yp8FUZnO64Qvyx5G@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ruansy.fnst@fujitsu.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).