From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1037478AbdE0BUO (ORCPT ); Fri, 26 May 2017 21:20:14 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34747 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1948838AbdEZXai (ORCPT ); Fri, 26 May 2017 19:30:38 -0400 Date: Fri, 26 May 2017 16:30:20 -0700 (PDT) From: Richard Narron X-X-Sender: comet.berkeley@joy.test To: Joe Perches cc: linux-kernel@vger.kernel.org, Christoph Hellwig , Jens Axboe , Andries Brouwer Subject: Re: [PATCH v3 1/1] partitions/msdos: FreeBSD UFS2 file systems are not recognized In-Reply-To: <1495809112.29207.30.camel@perches.com> Message-ID: References: <1495809112.29207.30.camel@perches.com> User-Agent: Alpine 2.21 (LNX 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: [] >> 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. I'm new to this forum and did not know who you were so I looked up your name in old threads and oddly enough found this thread about a strcmp bug: http://marc.info/?l=linux-kernel&m=125848558316468&w=2 http://marc.info/?l=linux-kernel&m=125847802903422&w=2