Re: [PATCH] ovl: properly print correct variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 22 Jul 2025, Antonio Quartulli wrote:
> In case of ovl_lookup_temp() failure, we currently print `err`
> which is actually not initialized at all.
> 
> Instead, properly print PTR_ERR(whiteout) which is where the
> actual error really is.
> 
> Address-Coverity-ID: 1647983 ("Uninitialized variables  (UNINIT)")
> Fixes: 8afa0a7367138 ("ovl: narrow locking in ovl_whiteout()")
> Signed-off-by: Antonio Quartulli <antonio@xxxxxxxxxxxxx>

Reviewed-by: NeilBrown <neil@xxxxxxxxxx>

Thanks for this.  I would probably go a step further and make the "err"
variable local to the two blocks that it appears in - then this error
would be detected by the compiler.
That isn't necessary though - this patch is good as it is.

Thanks,
NeilBrown


> ---
>  fs/overlayfs/dir.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index 30619777f0f6..70b8687dc45e 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -117,8 +117,9 @@ static struct dentry *ovl_whiteout(struct ovl_fs *ofs)
>  		if (!IS_ERR(whiteout))
>  			return whiteout;
>  		if (PTR_ERR(whiteout) != -EMLINK) {
> -			pr_warn("Failed to link whiteout - disabling whiteout inode sharing(nlink=%u, err=%i)\n",
> -				ofs->whiteout->d_inode->i_nlink, err);
> +			pr_warn("Failed to link whiteout - disabling whiteout inode sharing(nlink=%u, err=%lu)\n",
> +				ofs->whiteout->d_inode->i_nlink,
> +				PTR_ERR(whiteout));
>  			ofs->no_shared_whiteout = true;
>  		}
>  	}
> -- 
> 2.49.1
> 
> 






[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux