dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
Cc: edmund.j.dea@intel.com, sam@ravnborg.org,
	dri-devel@lists.freedesktop.org, sfr@canb.auug.org.au
Subject: Re: [PATCH] drm/kmb: Fix for build errors with Warray-bounds
Date: Thu, 27 Jan 2022 13:13:36 -0800	[thread overview]
Message-ID: <202201271312.85B63F9@keescook> (raw)
In-Reply-To: <20220127194227.2213608-1-anitha.chrisanthus@intel.com>

On Thu, Jan 27, 2022 at 11:42:27AM -0800, Anitha Chrisanthus wrote:
> This fixes the following build error
> 
> drivers/gpu/drm/kmb/kmb_plane.c: In function 'kmb_plane_atomic_disable':
> drivers/gpu/drm/kmb/kmb_plane.c:165:34: error: array subscript 3 is
> above array bounds of 'struct layer_status[2]' [-Werror=array-bounds]
>   165 |                 kmb->plane_status[plane_id].ctrl =
>   LCD_CTRL_GL2_ENABLE;
>   |                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~
>   In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
>   drivers/gpu/drm/kmb/kmb_drv.h:61:41: note: while referencing
>   'plane_status'
>   61 |         struct layer_status
>   plane_status[KMB_MAX_PLANES];

This would be better without the line wrapping (to match the actual
output), but otherwise:

Reviewed-by: Kees Cook <keescook@chromium.org>

>   |                                         ^~~~~~~~~~~~
>   drivers/gpu/drm/kmb/kmb_plane.c:162:34: error: array
>   subscript 2 is above array bounds of 'struct
>   layer_status[2]' [-Werror=array-bounds]
>   162 |
>   kmb->plane_status[plane_id].ctrl =
>   LCD_CTRL_GL1_ENABLE;
>   |                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~
>   In file included from
>   drivers/gpu/drm/kmb/kmb_plane.c:17:
>   drivers/gpu/drm/kmb/kmb_drv.h:61:41: note:
>   while referencing 'plane_status'
>   61 |         struct layer_status
>   plane_status[KMB_MAX_PLANES];
>   |
>   ^~~~~~~~~~~~
> 
> Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
> Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
> ---
>  drivers/gpu/drm/kmb/kmb_plane.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/kmb/kmb_plane.c b/drivers/gpu/drm/kmb/kmb_plane.c
> index 00404ba4126d..2735b8eb3537 100644
> --- a/drivers/gpu/drm/kmb/kmb_plane.c
> +++ b/drivers/gpu/drm/kmb/kmb_plane.c
> @@ -158,12 +158,6 @@ static void kmb_plane_atomic_disable(struct drm_plane *plane,
>  	case LAYER_1:
>  		kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;
>  		break;
> -	case LAYER_2:
> -		kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE;
> -		break;
> -	case LAYER_3:
> -		kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
> -		break;
>  	}
>  
>  	kmb->plane_status[plane_id].disable = true;
> -- 
> 2.25.1
> 

-- 
Kees Cook

  reply	other threads:[~2022-01-27 21:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 19:42 [PATCH] drm/kmb: Fix for build errors with Warray-bounds Anitha Chrisanthus
2022-01-27 21:13 ` Kees Cook [this message]
2022-01-27 22:34   ` Chrisanthus, Anitha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202201271312.85B63F9@keescook \
    --to=keescook@chromium.org \
    --cc=anitha.chrisanthus@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edmund.j.dea@intel.com \
    --cc=sam@ravnborg.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox