radeon: return EINVAL for 0 length buffers.
authorRobert Noland <rnoland@2hip.net>
Wed, 14 Oct 2009 18:58:56 +0000 (13:58 -0500)
committerAlex Deucher <alexdeucher@gmail.com>
Thu, 15 Oct 2009 15:29:35 +0000 (11:29 -0400)
Signed-off-by: Robert Noland <rnoland@2hip.net>
src/mesa/drivers/dri/radeon/radeon_bo_legacy.c

index 3e7547d..ce60a2f 100644 (file)
@@ -710,6 +710,10 @@ int radeon_bo_legacy_validate(struct radeon_bo *bo,
                 bo, bo->size, bo_legacy->map_count);
         return -EINVAL;
     }
+    if(bo->size == 0) {
+        fprintf(stderr, "bo(%p) has size 0.\n", bo);
+        return -EINVAL;
+    }
     if (bo_legacy->static_bo || bo_legacy->validated) {
         *soffset = bo_legacy->offset;
         *eoffset = bo_legacy->offset + bo->size;