public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Richard Narron <comet.berkeley@gmail.com>
Cc: linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Jens Axboe <axboe@kernel.dk>, Andries Brouwer <aeb@cwi.nl>
Subject: Re: [PATCH v3 1/1] partitions/msdos: FreeBSD UFS2 file systems are not recognized
Date: Fri, 26 May 2017 16:42:04 -0700	[thread overview]
Message-ID: <1495842124.9389.2.camel@perches.com> (raw)
In-Reply-To: <alpine.LNX.2.21.1705261612360.2379@joy.test>

On Fri, 2017-05-26 at 16:30 -0700, Richard Narron wrote:
> On Fri, 26 May 2017, Joe Perches wrote:
> 
> > On Fri, 2017-05-26 at 03:48 -0700, Richard Narron wrote:
> > > The code in block/partitions/msdos.c recognizes FreeBSD, OpenBSD
> > > and NetBSD partitions and does a reasonable job picking out OpenBSD
> > > and NetBSD UFS subpartitions.
> > > 
> > > But for FreeBSD the subpartitions are always "bad".
> > > 
> > >      Kernel: <bsd:bad subpartition - ignored
> > 
> > []
> > >   block/partitions/msdos.c | 2 ++
> > 
> > []
> > > @@ -300,6 +300,8 @@ static void parse_bsd(struct parsed_part
> > >   			continue;
> > >   		bsd_start = le32_to_cpu(p->p_offset);
> > >   		bsd_size = le32_to_cpu(p->p_size);
> > > +		if (memcmp(flavour, "bsd\0", 4) == 0)
> > 
> > Weird code.  Why not:
> > 
> > 		if (strcmp(flavor, "bsd") == 0)
> > 
> 
> I instinctively trust the memcmp function as it seems more like 
> assembly language to me and more straight forward and more reliable than 
> strcmp.

That really doesn't matter.

Your code stores "bsd\0\0" and not just "bsd\0"

  reply	other threads:[~2017-05-27  1:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 10:48 [PATCH v3 1/1] partitions/msdos: FreeBSD UFS2 file systems are not recognized Richard Narron
2017-05-26 13:23 ` Jens Axboe
2017-05-26 14:31 ` Joe Perches
2017-05-26 23:30   ` Richard Narron
2017-05-26 23:42     ` Joe Perches [this message]
     [not found]       ` <alpine.LNX.2.21.1705261737590.2924@joy.test>
2017-05-27  1:54         ` Joe Perches
2017-05-27  3:20           ` Richard Narron
2017-05-27  3:48             ` Joe Perches

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=1495842124.9389.2.camel@perches.com \
    --to=joe@perches.com \
    --cc=aeb@cwi.nl \
    --cc=axboe@kernel.dk \
    --cc=comet.berkeley@gmail.com \
    --cc=hch@lst.de \
    --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