Re: [Linuxptp-users] Missing Sanity Checks for malloc()/calloc()/strdup() in linuxptp-1.5
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Keller, J. E <jac...@in...> - 2015-09-01 21:34:41
|
> -----Original Message----- > From: Miroslav Lichvar [mailto:mli...@re...] > Sent: Thursday, August 27, 2015 8:16 AM > To: lin...@li... > Subject: Re: [Linuxptp-users] Missing Sanity Checks for > malloc()/calloc()/strdup() in linuxptp-1.5 > > On Thu, Aug 27, 2015 at 04:06:23PM +0200, Xavier Bestel wrote: > > Under linux malloc() will only return NULL when you get out of address > > space, i.e. virtually never on a 64bits machine. Low memory situations are > > handled elsewhere (e.g. OOM killer). > > So I don't think checking malloc() for NULL is that wise. > > It depends on the kernel overcommit configuration. In the default > configuration getting NULL is unlikely, but that doesn't mean it > should result in a segfault. I'm just not convinced there is any point > in trying to recover from that. > Generally, no, and I would prefer we at least try and die gracefully, and if *every* place we check will die gracefully, then why force each end point to die itself? By die gracefully here, I mean not segfault, but just instantly quit. Regards, Jake |