Re: [Powertop] [PATCH 1/2] perf_bundle: Check memory allocation failure

Namhyung Kim <namhyung at gmail.com> Tue, 18 Sep 2012 23:33:44 +0900
Newsgroups dev.linux.lists.powertop
Message-ID <1347978824.1771.4.camel@leonhard>
2012-09-18 (화), 07:25 -0700, Arjan van de Ven:
> On 9/18/2012 7:21 AM, Namhyung Kim wrote:
> > Check return value of malloc/strdup not to make NULL dereferences.
> 
> I don't mind these patches; they are clean code
> 
> however, one of the core userspace developers at work basically said "we don't check for malloc NULL in userspace;
> if that ever happens the system is so screwed up anyway that you just cannot continue".

Thanks for the quick reply. :)

Basically I agree with you.  But even in that case it'd be better
letting a user know about current situation somehow rather than just
segfault.  Maybe by replacing them to xmalloc or so?

Thanks,
Namhyung