public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Filipe Manana <fdmanana@kernel.org>
Cc: Mark Harmstone <mark@harmstone.com>,
	linux-btrfs@vger.kernel.org, wqu@suse.com, boris@bur.io,
	dsterba@suse.cz
Subject: Re: [PATCH v4] btrfs: add BTRFS_IOC_GET_CSUMS ioctl
Date: Wed, 15 Apr 2026 23:39:41 +0200	[thread overview]
Message-ID: <20260415213941.GS12792@twin.jikos.cz> (raw)
In-Reply-To: <CAL3q7H5UYpm5rc2xU2H2oKjuZ3NjWcq9QL647QsSgBCd3oEY_g@mail.gmail.com>

On Wed, Apr 15, 2026 at 06:46:46PM +0100, Filipe Manana wrote:
> > @@ -5140,6 +5141,344 @@ static int btrfs_ioctl_shutdown(struct btrfs_fs_info *fs_info, unsigned long arg
> >         return ret;
> >  }
> >
> > +#define GET_CSUMS_BUF_MAX      SZ_16M
> > +
> > +static int copy_csums_to_user(struct btrfs_fs_info *fs_info, u64 disk_bytenr,
> > +                             u64 len, u8 __user *buf)
> > +{
> > +       struct btrfs_root *csum_root;
> > +       struct btrfs_ordered_sum *sums;
> > +       LIST_HEAD(list);
> > +       const u32 csum_size = fs_info->csum_size;
> > +       int ret;
> > +
> > +       csum_root = btrfs_csum_root(fs_info, disk_bytenr);
> 
> Please, check that the root is not null; if it is null, log an error
> message and return an error.
> We found many missing instances that sometimes triggered null pointer
> dereferences when the file system was corrupted or mounted with the
> rescue option, among other issues.

We can start adding the __must_check annotations.

  reply	other threads:[~2026-04-15 21:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 16:59 [PATCH v4] btrfs: add BTRFS_IOC_GET_CSUMS ioctl Mark Harmstone
2026-04-15 17:46 ` Filipe Manana
2026-04-15 21:39   ` David Sterba [this message]
2026-04-16 17:58     ` Mark Harmstone

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=20260415213941.GS12792@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=boris@bur.io \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mark@harmstone.com \
    --cc=wqu@suse.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