lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9a8748490804221421x43271510nac6934f1ce37f500@mail.gmail.com>
Date:	Tue, 22 Apr 2008 23:21:10 +0200
From:	"Jesper Juhl" <jesper.juhl@...il.com>
To:	"Joe Perches" <joe@...ches.com>
Cc:	"Roman Zippel" <zippel@...ux-m68k.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hfs: if match_strdup() fails to allocate memory in parse_options(), don't blow up the kernel.

On 22/04/2008, Joe Perches <joe@...ches.com> wrote:
> On Tue, 2008-04-22 at 23:12 +0200, Jesper Juhl wrote:
>  > From: Jesper Juhl <jesper.juhl@...il.com>
>
> > diff --git a/fs/hfs/super.c b/fs/hfs/super.c
>  > index 32de44e..221e314 100644
>  > --- a/fs/hfs/super.c
>  > +++ b/fs/hfs/super.c
>  > @@ -297,6 +297,10 @@ static int parse_options(char *options, struct hfs_sb_info *hsb)
>  >                               return 0;
>  >                       }
>  >                       p = match_strdup(&args[0]);
>  > +                     if (!p) {
>  > +                             printk(KERN_ERR "hfs: mem alloc failed in match_strdup()\n");
>  > +                             return 0;
>  > +                     }
>  >                       hsb->nls_disk = load_nls(p);
>  >                       if (!hsb->nls_disk) {
>  >                               printk(KERN_ERR "hfs: unable to load codepage \"%s\"\n", p);
>  > @@ -311,6 +315,10 @@ static int parse_options(char *options, struct hfs_sb_info *hsb)
>  >                               return 0;
>  >                       }
>  >                       p = match_strdup(&args[0]);
>  > +                     if (!p) {
>  > +                             printk(KERN_ERR "hfs: memory allocation failed in match_strdup()\n");
>  > +                             return 0;
>  > +                     }
>  >                       hsb->nls_io = load_nls(p);
>  >                       if (!hsb->nls_io) {
>  >                               printk(KERN_ERR "hfs: unable to load iocharset \"%s\"\n", p);
>  >
>
>
> Using different strings in the printk wastes memory.
>

True, but I personally prefer being able to do  grep "error message"
and hit just one source location over saving a few bytes of memory...
If Roman wants the strings to be identical I can resubmit the patch. Roman?

-- 
Jesper Juhl <jesper.juhl@...il.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ