Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Aug 2002 03:41:37 +0400
From:      "Andrey A. Chernov" <ache@nagual.pp.ru>
To:        phk@FreeBSD.ORG, current@FreeBSD.ORG
Subject:   Re: phk malloc() sometimes forget to set errno
Message-ID:  <20020807234135.GA1359@nagual.pp.ru>
In-Reply-To: <20020807232750.GA1168@nagual.pp.ru>
References:  <20020807232750.GA1168@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 08, 2002 at 03:27:52 +0400, Andrey A. Chernov wrote:
> I found at least one case:
> 
> --------------------------------------------
> imalloc(...)
> ...
> if ((size + malloc_pagesize) < size)        /* Check for overflow */
> 	result = 0;
> ...
> return result;
> --------------------------------------------
> 
> I.e. NULL returned, but errno is not set and can be even 0
> 
> Please fix this bug. According to POSIX, ENOMEM is required at least, but
> EINVAL here is more applicable (as POSIX extension).

Hmm. From second thought ENOMEM here will be right, since 'size' is valid.

Other places without errno I found:

all places with
	wrtwarning("....");
	return 0;

errno is not set here too. EINVAL or EFAULT...

-- 
Andrey A. Chernov
http://ache.pp.ru/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020807234135.GA1359>