Skip to contentSkip to conversation

mincore() should return EINVAL for length < 0

PATCH New Badari Pulavarty 1 participant 1 message Oct 10, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mincore() should return EINVAL for length < 0

Hi,

Here is the simple patch to fix mincore() returning wrong error. mincore(2) manpage says, it should return EINVAL, if length is non-positive.

Bug details are in:

http://bugme.osdl.org/show_bug.cgi?id=4612

Thanks,
Badari

mm/mincore.c +1 -1
@@ -115,7 +115,7 @@ asmlinkage long sys_mincore(unsigned lon
 	long error;
 
 	/* check the arguments */
- 	if (start & ~PAGE_CACHE_MASK)
+ 	if ((start & ~PAGE_CACHE_MASK) || ((ssize_t)len < 0))
 		goto einval;
 
 	limit = TASK_SIZE;