From: Mateusz Guzik <mguzik@redhat.com>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: joern@logfs.org, prasadjoshi.linux@gmail.com, logfs@logfs.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Check for Null return from logfs_readpage_nolock in btree_write_block
Date: Mon, 16 Jun 2014 22:06:26 +0200 [thread overview]
Message-ID: <20140616200625.GA27360@mguzik.redhat.com> (raw)
In-Reply-To: <1402948021-8797-1-git-send-email-xerofoify@gmail.com>
On Mon, Jun 16, 2014 at 03:47:01PM -0400, Nicholas Krause wrote:
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> fs/logfs/readwrite.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
> index 4814031..adb9233 100644
> --- a/fs/logfs/readwrite.c
> +++ b/fs/logfs/readwrite.c
> @@ -2210,6 +2210,8 @@ void btree_write_block(struct logfs_block *block)
> page = logfs_get_write_page(inode, block->bix, block->level);
>
> err = logfs_readpage_nolock(page);
> + if (!err)
> + return -ENOMEM;
> BUG_ON(err);
> BUG_ON(!PagePrivate(page));
> BUG_ON(logfs_block(page) != block);
This function returns 0 on success, which you turn into error condition
and return -ENOMEM.
But the function returns void, thus it cannot return the error.
It does not allocate anything, thus -ENOMEM would not be appropriate in
the first place.
Since the function returns error, nobody would check the condition in
the first place.
Even if it was not void, it would either have to return the error or
oops on BUG_ON(err).
Read the code more carefully and at least compile-test your changes.
Instructions how to compile the kernel can be found here:
http://kernelnewbies.org/FAQ/KernelCompilation
I would also suggest letting the patch wait few hours and have another
look before sending.
Cheers,
--
Mateusz Guzik
next prev parent reply other threads:[~2014-06-16 20:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-16 19:47 Nicholas Krause
2014-06-16 20:06 ` Mateusz Guzik [this message]
[not found] ` <CAPDOMVgDUgfr9oqGmQ2a6u9Jm0eyBP=RP8EbCuHmnu-MRb+=+w@mail.gmail.com>
2014-06-17 1:20 ` Jörn Engel
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=20140616200625.GA27360@mguzik.redhat.com \
--to=mguzik@redhat.com \
--cc=joern@logfs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=logfs@logfs.org \
--cc=prasadjoshi.linux@gmail.com \
--cc=xerofoify@gmail.com \
/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
Powered by JetHome