aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_scatter.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_scatter.c')
-rw-r--r--drivers/gpu/drm/drm_scatter.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
index d5c386154246..ca520028b2cb 100644
--- a/drivers/gpu/drm/drm_scatter.c
+++ b/drivers/gpu/drm/drm_scatter.c
@@ -99,6 +99,9 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
if (!drm_core_check_feature(dev, DRIVER_SG))
return -EOPNOTSUPP;
+ if (request->size > SIZE_MAX - PAGE_SIZE)
+ return -EINVAL;
+
if (dev->sg)
return -EINVAL;