public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Mike Fleetwood <mike.fleetwood@googlemail.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>, kernel-team@fb.com
Subject: Re: [PATCH 1/2] btrfs-progs: receive: get rid of unnecessary strdup()
Date: Sat, 20 Jul 2019 20:17:21 -0700	[thread overview]
Message-ID: <20190721031721.GA8955@vader> (raw)
In-Reply-To: <CAMU1PDhmxhtiUVYX7q-04FamEbOTFz2o7NQoQpWcMv-GsaJLLw@mail.gmail.com>

On Sat, Jul 20, 2019 at 09:34:24AM +0100, Mike Fleetwood wrote:
> On Sat, 20 Jul 2019 at 06:43, Omar Sandoval <osandov@osandov.com> wrote:
> >
> > From: Omar Sandoval <osandov@fb.com>
> >
> > In process_clone(), we're not checking the return value of strdup().
> > But, there's no reason to strdup() in the first place: we just pass the
> > path into path_cat_out(). Get rid of the strdup().
> >
> > Fixes: f1c24cd80dfd ("Btrfs-progs: add btrfs send/receive commands")
> > Signed-off-by: Omar Sandoval <osandov@osandov.com>
> > ---
> >  cmds/receive.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/cmds/receive.c b/cmds/receive.c
> > index b97850a7..a3e62985 100644
> > --- a/cmds/receive.c
> > +++ b/cmds/receive.c
> > @@ -739,7 +739,7 @@ static int process_clone(const char *path, u64 offset, u64 len,
> >         struct btrfs_ioctl_clone_range_args clone_args;
> >         struct subvol_info *si = NULL;
> >         char full_path[PATH_MAX];
> > -       char *subvol_path = NULL;
> > +       char *subvol_path;
> I think that should become const char *.

Yeah, that wouldn't hurt. Dave, can you add that when you apply this or
should I resend?

  reply	other threads:[~2019-07-21  3:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-20  5:39 [PATCH 0/2] btrfs-progs: fix clone from wrong subvolume Omar Sandoval
2019-07-20  5:40 ` [PATCH 1/2] btrfs-progs: receive: get rid of unnecessary strdup() Omar Sandoval
2019-07-20  5:42   ` Omar Sandoval
2019-07-20  8:34   ` Mike Fleetwood
2019-07-21  3:17     ` Omar Sandoval [this message]
2019-07-20  5:40 ` [PATCH 2/2] btrfs-progs: receive: don't lookup clone root for received subvolume Omar Sandoval
2019-07-22 12:16   ` Filipe Manana
2019-07-22 18:20     ` Omar Sandoval

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=20190721031721.GA8955@vader \
    --to=osandov@osandov.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mike.fleetwood@googlemail.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