kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/komeda: Off by one in komeda_fb_get_pixel_addr()
@ 2019-01-23  9:37 Dan Carpenter
  2019-01-24  2:03 ` james qian wang (Arm Technology China)
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-01-23  9:37 UTC (permalink / raw)
  To: James (Qian) Wang; +Cc: David Airlie, Liviu Dudau, kernel-janitors, dri-devel

The > should be >= to avoid an off by one bug.

Fixes: c46c24bb6b11 ("drm/komeda: Add komeda_framebuffer")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---

I'm 98% sure this is correct, but please review it carefully because I'm
not 100% positive.

 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index 4ddd5314ca23..23ee74d42239 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -144,7 +144,7 @@ komeda_fb_get_pixel_addr(struct komeda_fb *kfb, int x, int y, int plane)
 	const struct drm_gem_cma_object *obj;
 	u32 plane_x, plane_y, cpp, pitch, offset;
 
-	if (plane > fb->format->num_planes) {
+	if (plane >= fb->format->num_planes) {
 		DRM_DEBUG_KMS("Out of max plane num.\n");
 		return -EINVAL;
 	}
-- 
2.17.1

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

* Re: drm/komeda: Off by one in komeda_fb_get_pixel_addr()
  2019-01-23  9:37 [PATCH] drm/komeda: Off by one in komeda_fb_get_pixel_addr() Dan Carpenter
@ 2019-01-24  2:03 ` james qian wang (Arm Technology China)
  0 siblings, 0 replies; 2+ messages in thread
From: james qian wang (Arm Technology China) @ 2019-01-24  2:03 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Airlie, kernel-janitors@vger.kernel.org, nd, Liviu Dudau,
	dri-devel@lists.freedesktop.org

On Wed, Jan 23, 2019 at 12:37:55PM +0300, Dan Carpenter wrote:
> The > should be >= to avoid an off by one bug.
> 
> Fixes: c46c24bb6b11 ("drm/komeda: Add komeda_framebuffer")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> 
> I'm 98% sure this is correct, but please review it carefully because I'm
> not 100% positive.

Hi Dan:

Thank you, this is a typo and your fix is correct.

Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>

Best Regards
James.

> 
>  drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> index 4ddd5314ca23..23ee74d42239 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> @@ -144,7 +144,7 @@ komeda_fb_get_pixel_addr(struct komeda_fb *kfb, int x, int y, int plane)
>  	const struct drm_gem_cma_object *obj;
>  	u32 plane_x, plane_y, cpp, pitch, offset;
>  
> -	if (plane > fb->format->num_planes) {
> +	if (plane >= fb->format->num_planes) {
>  		DRM_DEBUG_KMS("Out of max plane num.\n");
>  		return -EINVAL;
>  	}

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

end of thread, other threads:[~2019-01-24  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-23  9:37 [PATCH] drm/komeda: Off by one in komeda_fb_get_pixel_addr() Dan Carpenter
2019-01-24  2:03 ` james qian wang (Arm Technology China)

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).