Message ID | 20140409152112.GD24536@mwanda (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Hi Dan, Thanks for the patch. On 04/09/2014 05:21 PM, Dan Carpenter wrote: > Smatch complains that we are reading beyond the end of the array here: > > drivers/gpu/drm/panel/panel-s6e8aa0.c:852 s6e8aa0_read_mtp_id() > warn: buffer overflow 's6e8aa0_variants' 4 <= 4 > > We set the error code, so it's not harmful but it looks like a return > was intended here so lets add that and silence the warning. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Andrzej Hajda <a.hajda@samsung.com> > --- > Compile tested only. > > diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c > index 35941d2..06e57a2 100644 > --- a/drivers/gpu/drm/panel/panel-s6e8aa0.c > +++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c > @@ -847,6 +847,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx) > if (i >= ARRAY_SIZE(s6e8aa0_variants)) { > dev_err(ctx->dev, "unsupported display version %d\n", id[1]); > ctx->error = -EINVAL; > + return; > } > > ctx->variant = &s6e8aa0_variants[i]; >
On Wed, Apr 09, 2014 at 06:21:12PM +0300, Dan Carpenter wrote: > Smatch complains that we are reading beyond the end of the array here: > > drivers/gpu/drm/panel/panel-s6e8aa0.c:852 s6e8aa0_read_mtp_id() > warn: buffer overflow 's6e8aa0_variants' 4 <= 4 > > We set the error code, so it's not harmful but it looks like a return > was intended here so lets add that and silence the warning. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Applied, thanks. Thierry
diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c index 35941d2..06e57a2 100644 --- a/drivers/gpu/drm/panel/panel-s6e8aa0.c +++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c @@ -847,6 +847,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx) if (i >= ARRAY_SIZE(s6e8aa0_variants)) { dev_err(ctx->dev, "unsupported display version %d\n", id[1]); ctx->error = -EINVAL; + return; } ctx->variant = &s6e8aa0_variants[i];
Smatch complains that we are reading beyond the end of the array here: drivers/gpu/drm/panel/panel-s6e8aa0.c:852 s6e8aa0_read_mtp_id() warn: buffer overflow 's6e8aa0_variants' 4 <= 4 We set the error code, so it's not harmful but it looks like a return was intended here so lets add that and silence the warning. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- Compile tested only.