linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/tegra: Fix comparison operator for buffer size
@ 2018-06-20 13:03 Mikko Perttunen
  2018-06-20 15:11 ` Dmitry Osipenko
  2018-06-21 13:36 ` Thierry Reding
  0 siblings, 2 replies; 3+ messages in thread
From: Mikko Perttunen @ 2018-06-20 13:03 UTC (permalink / raw)
  To: thierry.reding, jonathanh; +Cc: linux-tegra, digetx, dri-devel, Mikko Perttunen

Here we are checking for the buffer length, not an offset for writing
to, so using > is correct. The current code incorrectly rejects a
command buffer ending at the memory buffer's end.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/gpu/drm/tegra/drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 776c1513e582..a2bd5876c633 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -398,7 +398,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
 		 * unaligned offset is malformed and cause commands stream
 		 * corruption on the buffer address relocation.
 		 */
-		if (offset & 3 || offset >= obj->gem.size) {
+		if (offset & 3 || offset > obj->gem.size) {
 			err = -EINVAL;
 			goto fail;
 		}
-- 
2.16.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/tegra: Fix comparison operator for buffer size
  2018-06-20 13:03 [PATCH] drm/tegra: Fix comparison operator for buffer size Mikko Perttunen
@ 2018-06-20 15:11 ` Dmitry Osipenko
  2018-06-21 13:36 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2018-06-20 15:11 UTC (permalink / raw)
  To: Mikko Perttunen; +Cc: linux-tegra, thierry.reding, dri-devel, jonathanh

On Wednesday, 20 June 2018 16:03:58 MSK Mikko Perttunen wrote:
> Here we are checking for the buffer length, not an offset for writing
> to, so using > is correct. The current code incorrectly rejects a
> command buffer ending at the memory buffer's end.
> 
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
>  drivers/gpu/drm/tegra/drm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 776c1513e582..a2bd5876c633 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -398,7 +398,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>  		 * unaligned offset is malformed and cause commands stream
>  		 * corruption on the buffer address relocation.
>  		 */
> -		if (offset & 3 || offset >= obj->gem.size) {
> +		if (offset & 3 || offset > obj->gem.size) {
>  			err = -EINVAL;
>  			goto fail;
>  		}

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/tegra: Fix comparison operator for buffer size
  2018-06-20 13:03 [PATCH] drm/tegra: Fix comparison operator for buffer size Mikko Perttunen
  2018-06-20 15:11 ` Dmitry Osipenko
@ 2018-06-21 13:36 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2018-06-21 13:36 UTC (permalink / raw)
  To: Mikko Perttunen; +Cc: linux-tegra, digetx, dri-devel, jonathanh


[-- Attachment #1.1: Type: text/plain, Size: 450 bytes --]

On Wed, Jun 20, 2018 at 04:03:58PM +0300, Mikko Perttunen wrote:
> Here we are checking for the buffer length, not an offset for writing
> to, so using > is correct. The current code incorrectly rejects a
> command buffer ending at the memory buffer's end.
> 
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
>  drivers/gpu/drm/tegra/drm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-21 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 13:03 [PATCH] drm/tegra: Fix comparison operator for buffer size Mikko Perttunen
2018-06-20 15:11 ` Dmitry Osipenko
2018-06-21 13:36 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).