drm/qxl: array underflow in qxl_clientcap_ioctl()
Subsystems (3)
PATCH 3/4 drm/qxl: array underflow in qxl_clientcap_ioctl()
We check that "byte" isn't writing beyond the end of the array but we also need to prevent array underflow.
drivers/gpu/drm/qxl/qxl_ioctl.c +1 -1
@@ -372,7 +372,7 @@ static int qxl_clientcap_ioctl(struct drm_device *dev, void *data, {struct qxl_device *qdev = dev->dev_private;struct drm_qxl_clientcap *param = data; -int byte, idx; +unsigned int byte, idx; byte = param->index /8 ; idx = param->index %8 ;
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 20 lines
We check that "byte" isn't writing beyond the end of the array but we also need to prevent array underflow.
Signed-off-by Dan Carpenter <[email protected]>drivers/gpu/drm/qxl/qxl_ioctl.c +1
-1@@ -372,7 +372,7 @@ static int qxl_clientcap_ioctl(struct drm_device *dev, void *data, {struct qxl_device *qdev = dev->dev_private;struct drm_qxl_clientcap *param = data; -int byte, idx; +unsigned int byte, idx; byte = param->index /8 ;
Quoted 2 lines
idx =
param->index% 8;
Actually there is no underflow. param->index is unsigned so either byte and idx are at the end positive as long as int is not less then 4 bytes (which I don't think is supported under Linux).
However I agree with the patch.
Acked!
Frediano Ziglio
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 1 line
Actually there is no underflow.
Oh, duh. You're right. Sorry for that.
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel