* [Ocfs2-devel] [bug report] ocfs2: fix a static checker warning
@ 2018-09-25 12:53 Dan Carpenter
2018-09-25 15:40 ` Gang He
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-09-25 12:53 UTC (permalink / raw)
To: ocfs2-devel
Sorry, Gang He,
The error message is still there.
The patch 8c4d5a438716: "ocfs2: fix a static checker warning" from
Jul 6, 2017, leads to the following static checker warning:
fs/ocfs2/export.c:127 ocfs2_get_dentry()
warn: 'inode' can also be NULL
fs/ocfs2/inode.c
161 args.fi_sysfile_type = sysfile_type;
162
163 inode = iget5_locked(sb, args.fi_ino, ocfs2_find_actor,
164 ocfs2_init_locked_inode, &args);
165 /* inode was *not* in the inode cache. 2.6.x requires
166 * us to do our own read_inode call and unlock it
167 * afterwards. */
168 if (inode == NULL) {
169 inode = ERR_PTR(-ENOMEM);
170 mlog_errno(PTR_ERR(inode));
171 goto bail;
172 }
173 trace_ocfs2_iget5_locked(inode->i_state);
174 if (inode->i_state & I_NEW) {
175 rc = ocfs2_read_locked_inode(inode, &args);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Imagine this succeeds.
176 unlock_new_inode(inode);
177 }
178 if (is_bad_inode(inode)) {
179 iput(inode);
180 inode = ERR_PTR(rc);
^^^^^^^^^^^^^^^^^^^
We're returning ERR_PTR(0) which is NULL which leads to a NULL
dereference in the caller.
181 goto bail;
182 }
183
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Ocfs2-devel] [bug report] ocfs2: fix a static checker warning
2018-09-25 12:53 [Ocfs2-devel] [bug report] ocfs2: fix a static checker warning Dan Carpenter
@ 2018-09-25 15:40 ` Gang He
0 siblings, 0 replies; 2+ messages in thread
From: Gang He @ 2018-09-25 15:40 UTC (permalink / raw)
To: ocfs2-devel
Hello Dan,
Thank for your finding, I will fix this warning.
-Gang
>>> On 2018/9/25 at 14:53, in message <20180925125347.GA1300@mwanda>, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> Sorry, Gang He,
>
> The error message is still there.
>
> The patch 8c4d5a438716: "ocfs2: fix a static checker warning" from
> Jul 6, 2017, leads to the following static checker warning:
>
> fs/ocfs2/export.c:127 ocfs2_get_dentry()
> warn: 'inode' can also be NULL
>
> fs/ocfs2/inode.c
> 161 args.fi_sysfile_type = sysfile_type;
> 162
> 163 inode = iget5_locked(sb, args.fi_ino, ocfs2_find_actor,
> 164 ocfs2_init_locked_inode, &args);
> 165 /* inode was *not* in the inode cache. 2.6.x requires
> 166 * us to do our own read_inode call and unlock it
> 167 * afterwards. */
> 168 if (inode == NULL) {
> 169 inode = ERR_PTR(-ENOMEM);
> 170 mlog_errno(PTR_ERR(inode));
> 171 goto bail;
> 172 }
> 173 trace_ocfs2_iget5_locked(inode->i_state);
> 174 if (inode->i_state & I_NEW) {
> 175 rc = ocfs2_read_locked_inode(inode, &args);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Imagine this succeeds.
>
> 176 unlock_new_inode(inode);
> 177 }
> 178 if (is_bad_inode(inode)) {
> 179 iput(inode);
> 180 inode = ERR_PTR(rc);
> ^^^^^^^^^^^^^^^^^^^
> We're returning ERR_PTR(0) which is NULL which leads to a NULL
> dereference in the caller.
>
> 181 goto bail;
> 182 }
> 183
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-25 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-25 12:53 [Ocfs2-devel] [bug report] ocfs2: fix a static checker warning Dan Carpenter
2018-09-25 15:40 ` Gang He
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.