From: Markus Elfring <Markus.Elfring@web.de>
To: Matthew Wilcox <willy@infradead.org>, linux-mm@kvack.org
Cc: kernel-janitors@vger.kernel.org,
Muchun Song <muchun.song@linux.dev>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] hugetlbfs: Improve exception handling in hugetlbfs_fill_super()
Date: Sat, 30 Dec 2023 07:45:51 +0100 [thread overview]
Message-ID: <621c7483-9a8c-431c-86e0-85d23b983471@web.de> (raw)
In-Reply-To: <ZY7dEbRJb1dHkQPd@casper.infradead.org>
>> +++ b/fs/hugetlbfs/inode.c
>> @@ -1483,7 +1483,7 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc)
>> ctx->max_hpages,
>> ctx->min_hpages);
>> if (!sbinfo->spool)
>> - goto out_free;
>> + goto free_sbinfo;
>> }
>> sb->s_maxbytes = MAX_LFS_FILESIZE;
>> sb->s_blocksize = huge_page_size(ctx->hstate);
>> @@ -1499,10 +1499,12 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc)
>> sb->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH;
>> sb->s_root = d_make_root(hugetlbfs_get_root(sb, ctx));
>> if (!sb->s_root)
>> - goto out_free;
>> + goto free_spool;
>> return 0;
>> -out_free:
>> +
>> +free_spool:
>> kfree(sbinfo->spool);
>> +free_sbinfo:
>> kfree(sbinfo);
>> return -ENOMEM;
>> }
>
> This is more complex. NACK.
I am curious how coding style preferences will evolve further.
See also:
https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources
Regards,
Markus
prev parent reply other threads:[~2023-12-30 6:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-29 11:36 [PATCH 0/2] hugetlbfs: Adjustments for two function implementations Markus Elfring
2023-12-29 11:37 ` [PATCH 1/2] hugetlbfs: Improve a size determination in two functions Markus Elfring
2024-01-02 2:57 ` Muchun Song
2023-12-29 11:40 ` [PATCH 2/2] hugetlbfs: Improve exception handling in hugetlbfs_fill_super() Markus Elfring
2023-12-29 14:52 ` Matthew Wilcox
2023-12-30 6:45 ` Markus Elfring [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=621c7483-9a8c-431c-86e0-85d23b983471@web.de \
--to=markus.elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=willy@infradead.org \
/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