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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121128190436.GR16230@one.firstfloor.org>
Date:	Wed, 28 Nov 2012 20:04:36 +0100
From:	Andi Kleen <andi@...stfloor.org>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	Andi Kleen <andi@...stfloor.org>, linux-kernel@...r.kernel.org,
	acme@...hat.com, peterz@...radead.org, eranian@...gle.com,
	mingo@...nel.org, namhyung@...nel.org,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 31/32] perf, tools: Default to cpu// for events v3

> > +static void str_append(char **s, int *len, const char *a)
> > +{
> > +	int olen = *s ? strlen(*s) : 0;
> > +	int nlen = olen + strlen(a) + 1;
> > +	if (*len < nlen) {
> > +		*len = *len * 2;
> > +		if (*len < nlen)
> > +			*len = nlen;
> > +		*s = realloc(*s, *len);
> > +		if (!*s)
> > +			exit(ENOMEM);
> 
> Rather use BUG_ON or event better return -ENOMEM.

Neither makes sense: the callers won't handle it and it's not a bug.
If you're out of memory in user space the only thing you can do is to 
exit.

> 
> > +		if (olen == 0)
> > +			**s = 0;
> > +	}
> > +	strcat(*s, a);
> > +}
> 
> Could this one be moved to util/string.c in some generic form?

Ok.

-Andi

-- 
ak@...ux.intel.com -- Speaking for myself only.
--
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