OCFS2-Devel Archive mirror
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Artem Chernyshev <artem.chernyshev@red-soft.ru>,
	Joel Becker <jlbec@evilplan.org>, Mark Fasheh <mark@fasheh.com>,
	akpm <akpm@linux-foundation.org>
Cc: Kurt Hackel <kurt.hackel@oracle.com>,
	ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] fs: ocfs2: Check status values
Date: Tue, 10 Oct 2023 09:20:05 +0800	[thread overview]
Message-ID: <7dfa521c-ee4c-60b2-bdd8-95b956183f3b@linux.alibaba.com> (raw)
In-Reply-To: <20231009141111.149858-1-artem.chernyshev@red-soft.ru>



On 10/9/23 10:11 PM, Artem Chernyshev wrote:
> Test return values before overwriting.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>

Looks good.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
>  fs/ocfs2/namei.c       | 8 ++++++++
>  fs/ocfs2/quota_local.c | 4 ++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
> index 5cd6d7771cea..836c4279a979 100644
> --- a/fs/ocfs2/namei.c
> +++ b/fs/ocfs2/namei.c
> @@ -1597,6 +1597,10 @@ static int ocfs2_rename(struct mnt_idmap *idmap,
>  	if (update_dot_dot) {
>  		status = ocfs2_update_entry(old_inode, handle,
>  					    &old_inode_dot_dot_res, new_dir);
> +		if (status < 0) {
> +			mlog_errno(status);
> +			goto bail;
> +		}
>  		drop_nlink(old_dir);
>  		if (new_inode) {
>  			drop_nlink(new_inode);
> @@ -1636,6 +1640,10 @@ static int ocfs2_rename(struct mnt_idmap *idmap,
>  							 INODE_CACHE(old_dir),
>  							 old_dir_bh,
>  							 OCFS2_JOURNAL_ACCESS_WRITE);
> +			if (status < 0) {
> +				mlog_errno(status);
> +				goto bail;
> +			}
>  			fe = (struct ocfs2_dinode *) old_dir_bh->b_data;
>  			ocfs2_set_links_count(fe, old_dir->i_nlink);
>  			ocfs2_journal_dirty(handle, old_dir_bh);
> diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
> index dfaae1e52412..e09842fc9d4d 100644
> --- a/fs/ocfs2/quota_local.c
> +++ b/fs/ocfs2/quota_local.c
> @@ -1240,6 +1240,10 @@ int ocfs2_create_local_dquot(struct dquot *dquot)
>  				     &od->dq_local_phys_blk,
>  				     &pcount,
>  				     NULL);
> +	if (status < 0) {
> +		mlog_errno(status);
> +		goto out;
> +	}
>  
>  	/* Initialize dquot structure on disk */
>  	status = ocfs2_local_write_dquot(dquot);

      reply	other threads:[~2023-10-10  2:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 14:11 [PATCH] fs: ocfs2: Check status values Artem Chernyshev
2023-10-10  1:20 ` Joseph Qi [this message]

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=7dfa521c-ee4c-60b2-bdd8-95b956183f3b@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=artem.chernyshev@red-soft.ru \
    --cc=jlbec@evilplan.org \
    --cc=kurt.hackel@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).