* [patch 3/4] drm/qxl: array underflow in qxl_clientcap_ioctl()
@ 2015-09-17 11:23 Dan Carpenter
2015-09-17 14:16 ` Frediano Ziglio
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-09-17 11:23 UTC (permalink / raw)
To: David Airlie
Cc: Dave Airlie, security, Ilja Van Sprundel, dri-devel,
Frediano Ziglio
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 <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
index b2db482..552dc06 100644
--- a/drivers/gpu/drm/qxl/qxl_ioctl.c
+++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
@@ -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
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch 3/4] drm/qxl: array underflow in qxl_clientcap_ioctl()
2015-09-17 11:23 [patch 3/4] drm/qxl: array underflow in qxl_clientcap_ioctl() Dan Carpenter
@ 2015-09-17 14:16 ` Frediano Ziglio
2015-09-17 19:06 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Frediano Ziglio @ 2015-09-17 14:16 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Dave Airlie, security, Ilja Van Sprundel, dri-devel
>
> 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 <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c
> b/drivers/gpu/drm/qxl/qxl_ioctl.c
> index b2db482..552dc06 100644
> --- a/drivers/gpu/drm/qxl/qxl_ioctl.c
> +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
> @@ -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;
>
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
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 3/4] drm/qxl: array underflow in qxl_clientcap_ioctl()
2015-09-17 14:16 ` Frediano Ziglio
@ 2015-09-17 19:06 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-09-17 19:06 UTC (permalink / raw)
To: Frediano Ziglio; +Cc: Dave Airlie, security, Ilja Van Sprundel, dri-devel
> Actually there is no underflow.
Oh, duh. You're right. Sorry for that.
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-17 19:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 11:23 [patch 3/4] drm/qxl: array underflow in qxl_clientcap_ioctl() Dan Carpenter
2015-09-17 14:16 ` Frediano Ziglio
2015-09-17 19:06 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.