login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
April
»
22
Re: [PATCH] hfs: if match_strdup() fails to allocate memory in parse_options(), don't blow up the kernel.
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Joe Perches <joe@...>
To: Jesper Juhl <jesper.juhl@...>
Cc: Roman Zippel <zippel@...>, <linux-kernel@...>
Subject:
Re: [PATCH] hfs: if match_strdup() fails to allocate memory in parse_options(), don't blow up the kernel.
Date: Tuesday, April 22, 2008 - 5:17 pm
On Tue, 2008-04-22 at 23:12 +0200, Jesper Juhl wrote:
quoted text
> From: Jesper Juhl <jesper.juhl@gmail.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. --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] hfs: if match_strdup() fails to allocate memory in p...
, Jesper Juhl
, (Tue Apr 22, 5:12 pm)
Re: [PATCH] hfs: if match_strdup() fails to allocate memory ...
, Joe Perches
, (Tue Apr 22, 5:17 pm)
Re: [PATCH] hfs: if match_strdup() fails to allocate memory ...
, Jesper Juhl
, (Tue Apr 22, 5:21 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Greg Kroah-Hartman
[PATCH 004/196] Chinese: add translation of SubmittingPatches
Amit K. Arora
[RFC] Heads up on sys_fallocate()
Laurent Riffard
Re: 2.6.25-rc2-mm1: WARNING at arch/x86/mm/ioremap.c:129
Alan Cox
Re: x86: 4kstacks default
linux-netdev
:
Jarek Poplawski
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Gerrit Renker
[PATCH 34/37] dccp: Auto-load (when supported) CCID plugins for negotiation
Maciej W. Rozycki
Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes
John P Poet
Realtek 8111C transmit timed out
git
:
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
2 users
and
928 guests
online.
Online users
workfromhomebiz
zeekec
Syndicate