All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report]  fs/9p: mitigate inode collisions
@ 2024-04-17 18:11 Dan Carpenter
  2024-04-17 18:50 ` Eric Van Hensbergen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-04-17 18:11 UTC (permalink / raw)
  To: ericvh; +Cc: v9fs

Hello Eric Van Hensbergen,

Commit 6ae7784008d9 (" fs/9p: mitigate inode collisions") from Apr
15, 2024 (linux-next), leads to the following Smatch static checker
warning:

	fs/9p/vfs_inode.c:513 v9fs_remove()
	error: uninitialized symbol 'v9fid'.

fs/9p/vfs_inode.c
    470 static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
    471 {
    472         struct inode *inode;
    473         int retval = -EOPNOTSUPP;
    474         struct p9_fid *v9fid, *dfid;
    475         struct v9fs_session_info *v9ses;
    476 
    477         p9_debug(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
    478                  dir, dentry, flags);
    479 
    480         v9ses = v9fs_inode2v9ses(dir);
    481         inode = d_inode(dentry);
    482         dfid = v9fs_parent_fid(dentry);
    483         if (IS_ERR(dfid)) {
    484                 retval = PTR_ERR(dfid);
    485                 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
    486                 return retval;
    487         }
    488         if (v9fs_proto_dotl(v9ses))
    489                 retval = p9_client_unlinkat(dfid, dentry->d_name.name,
    490                                             v9fs_at_to_dotl_flags(flags));
    491         p9_fid_put(dfid);
    492         if (retval == -EOPNOTSUPP) {
    493                 /* Try the one based on path */
    494                 v9fid = v9fs_fid_clone(dentry);
    495                 if (IS_ERR(v9fid))
    496                         return PTR_ERR(v9fid);
    497                 retval = p9_client_remove(v9fid);
    498         }

v9fid is not initialized if retval != -EOPNOTSUPP.

    499         if (!retval) {
    500                 /*
    501                  * directories on unlink should have zero
    502                  * link count
    503                  */
    504                 if (flags & AT_REMOVEDIR) {
    505                         clear_nlink(inode);
    506                         v9fs_dec_count(dir);
    507                 } else
    508                         v9fs_dec_count(inode);
    509 
    510                 if (inode->i_nlink <= 0) { /* no more refs unhash it */
    511                         remove_inode_hash(inode);
    512                 } else {
--> 513                         p9_debug(P9_DEBUG_ERROR,
    514                         "WARNING: unlink inode %lx %s qid->path=%llx w/i_nlink==%d\n",
    515                         inode->i_ino, dentry->d_name.name, v9fid->qid.path, inode->i_nlink);
                                                                   ^^^^^^^^^^^^^^^
Uninitialized.

    516                 }
    517 
    518                 v9fs_invalidate_inode_attr(inode);
    519                 v9fs_invalidate_inode_attr(dir);
    520 
    521                 /* invalidate all fids associated with dentry */
    522                 /* NOTE: This will not include open fids */
    523                 dentry->d_op->d_release(dentry);
    524         }
    525         return retval;
    526 }

regards,
dan carpenter

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

* Re: [bug report] fs/9p: mitigate inode collisions
  2024-04-17 18:11 [bug report] fs/9p: mitigate inode collisions Dan Carpenter
@ 2024-04-17 18:50 ` Eric Van Hensbergen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Van Hensbergen @ 2024-04-17 18:50 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: v9fs

On Wed, Apr 17, 2024 at 1:12 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Hello Eric Van Hensbergen,
>
> Commit 6ae7784008d9 (" fs/9p: mitigate inode collisions") from Apr
> 15, 2024 (linux-next), leads to the following Smatch static checker
> warning:
>
>         fs/9p/vfs_inode.c:513 v9fs_remove()
>         error: uninitialized symbol 'v9fid'.
>

Thanks for this, I've amended the patch to remove the print in
question since it was actually vestigial telemetry while I was
debugging and shouldn't have been in the patch in the first place.

     -eric

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

end of thread, other threads:[~2024-04-17 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 18:11 [bug report] fs/9p: mitigate inode collisions Dan Carpenter
2024-04-17 18:50 ` Eric Van Hensbergen

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.