public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] btrfs: sysfs: Handle NULL return values
Date: Sun, 5 Feb 2023 08:13:30 +0100	[thread overview]
Message-ID: <Y99XGrFvXBL32cOO@kroah.com> (raw)
In-Reply-To: <20230204183510.never.909-kees@kernel.org>

On Sat, Feb 04, 2023 at 10:35:10AM -0800, Kees Cook wrote:
> Each of to_fs_info(), discard_to_fs_info(), and to_space_info() can
> return NULL values.

The code says it could, but I really do not think that is possible at
all, especially based on the fact that there have never been any crashes
reported here.

So the NULL returns should just be removed instead, right?

Also, to_space_info() is a macro of container_of() which can not return
NULL.

And get_btrfs_kobj() is just odd, that probably should be fixed up as
well, that's an indication that something is wrong with the sysfs code
if anyone has to attempt to walk the whole kobject parent path :(

So while this patch might fix up the compiler warning, it's logically
not going to change anything, let's fix this properly.  I can look at it
next week if someone doesn't beat me to it.

thanks,

greg k-h

  reply	other threads:[~2023-02-05  7:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 18:35 [PATCH] btrfs: sysfs: Handle NULL return values Kees Cook
2023-02-05  7:13 ` Greg KH [this message]
2023-02-06 18:33   ` David Sterba
2023-02-06 18:37   ` Kees Cook

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=Y99XGrFvXBL32cOO@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=keescook@chromium.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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