linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Don't dereference NULL upon slashless module dependency line.
@ 2009-02-23 16:20 Jim Meyering
  2009-02-26 22:18 ` Eric Sandeen
  2009-03-09  0:41 ` Theodore Tso
  0 siblings, 2 replies; 3+ messages in thread
From: Jim Meyering @ 2009-02-23 16:20 UTC (permalink / raw)
  To: linux-ext4


* 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;
--
1.6.2.rc1.256.g58a87

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Don't dereference NULL upon slashless module dependency line.
  2009-02-23 16:20 [PATCH] Don't dereference NULL upon slashless module dependency line Jim Meyering
@ 2009-02-26 22:18 ` Eric Sandeen
  2009-03-09  0:41 ` Theodore Tso
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2009-02-26 22:18 UTC (permalink / raw)
  To: Jim Meyering; +Cc: linux-ext4

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Don't dereference NULL upon slashless module dependency line.
  2009-02-23 16:20 [PATCH] Don't dereference NULL upon slashless module dependency line Jim Meyering
  2009-02-26 22:18 ` Eric Sandeen
@ 2009-03-09  0:41 ` Theodore Tso
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Tso @ 2009-03-09  0:41 UTC (permalink / raw)
  To: Jim Meyering; +Cc: linux-ext4

On Mon, Feb 23, 2009 at 05:20:47PM +0100, Jim Meyering wrote:
> 
> * probe.c (check_for_modules): Skip current line if it has no slash.

Thanks for pointing this out; I've used Eric's patch to fix this
issue.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-09  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-23 16:20 [PATCH] Don't dereference NULL upon slashless module dependency line Jim Meyering
2009-02-26 22:18 ` Eric Sandeen
2009-03-09  0:41 ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).