Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jan 2012 08:58:59 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r230610 - head/sys/kern
Message-ID:  <201201270858.q0R8wx09030720@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri Jan 27 08:58:58 2012
New Revision: 230610
URL: http://svn.freebsd.org/changeset/base/230610

Log:
  Fix size check, that prevents getting negative after casting
  to a signed type
  
  Reviewed by:	bde

Modified:
  head/sys/kern/vfs_aio.c

Modified: head/sys/kern/vfs_aio.c
==============================================================================
--- head/sys/kern/vfs_aio.c	Fri Jan 27 08:46:32 2012	(r230609)
+++ head/sys/kern/vfs_aio.c	Fri Jan 27 08:58:58 2012	(r230610)
@@ -1553,7 +1553,7 @@ aio_aqueue(struct thread *td, struct aio
 	}
 
 	/* XXX: aio_nbytes is later casted to signed types. */
-	if ((int)aiocbe->uaiocb.aio_nbytes < 0) {
+	if (aiocbe->uaiocb.aio_nbytes > INT_MAX) {
 		uma_zfree(aiocb_zone, aiocbe);
 		return (EINVAL);
 	}



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