All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Jim Meyering <jim@meyering.net>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] Don't dereference NULL upon slashless module dependency line.
Date: Thu, 26 Feb 2009 16:18:29 -0600	[thread overview]
Message-ID: <49A71535.3010607@redhat.com> (raw)
In-Reply-To: <87fxi5dt0g.fsf@meyering.net>

Jim Meyering wrote:
> * probe.c (check_for_modules): Skip current line if it has no slash.
> 
> Signed-off-by: Jim Meyering <meyering@redhat.com>
> ---
> I found this by inspection while looking for the cause of
> a recent rawhide/nash segfault.
> 
>  lib/blkid/probe.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
> index 76763ae..f5fff6b 100644
> --- a/lib/blkid/probe.c
> +++ b/lib/blkid/probe.c
> @@ -225,8 +225,9 @@ static int check_for_modules(const char *fs_name)
>  			*cp = 0;
>  		else
>  			continue;
> -		if ((cp = strrchr(buf, '/')) != NULL)
> -			cp++;
> +		if ((cp = strrchr(buf, '/')) == NULL)
> +			continue;
> +		cp++;
>  		i = strlen(cp);
>  		if (i > 3) {
>  			t = cp + i - 3;
> --

oops, I missed that Jim sent this (or just didn't remember w/ my
goldfish brain)

OTOH the other patch I sent is probably a bit better, it gets both
pieces of duplicated(!) code, and doeesn't skip these lines in
modules.dep, it just skips the pre-"/"-stripping ...

-Eric

  reply	other threads:[~2009-02-26 22:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-23 16:20 [PATCH] Don't dereference NULL upon slashless module dependency line Jim Meyering
2009-02-26 22:18 ` Eric Sandeen [this message]
2009-03-09  0:41 ` Theodore Tso

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=49A71535.3010607@redhat.com \
    --to=sandeen@redhat.com \
    --cc=jim@meyering.net \
    --cc=linux-ext4@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.