All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
@ 2018-07-04  9:38   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-07-04  9:38 UTC (permalink / raw)
  To: Thierry Reding, Andrzej Hajda; +Cc: David Airlie, kernel-janitors, dri-devel

The ARRAY_SIZE() macro is type size_t.  If s6e8aa0_dcs_read() returns a
negative error code, then "ret < ARRAY_SIZE(id)" is false because the
negative error code is type promoted to a high positive value.

Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
index a188a3959f1a..6ad827b93ae1 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
@@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
 	int ret, i;
 
 	ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
-	if (ret < ARRAY_SIZE(id) || id[0] = 0x00) {
+	if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] = 0x00) {
 		dev_err(ctx->dev, "read id failed\n");
 		ctx->error = -EIO;
 		return;

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

* [PATCH] drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
@ 2018-07-04  9:38   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-07-04  9:38 UTC (permalink / raw)
  To: Thierry Reding, Andrzej Hajda; +Cc: David Airlie, kernel-janitors, dri-devel

The ARRAY_SIZE() macro is type size_t.  If s6e8aa0_dcs_read() returns a
negative error code, then "ret < ARRAY_SIZE(id)" is false because the
negative error code is type promoted to a high positive value.

Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
index a188a3959f1a..6ad827b93ae1 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
@@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
 	int ret, i;
 
 	ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
-	if (ret < ARRAY_SIZE(id) || id[0] == 0x00) {
+	if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) {
 		dev_err(ctx->dev, "read id failed\n");
 		ctx->error = -EIO;
 		return;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
  2018-07-04  9:38   ` Dan Carpenter
@ 2018-07-05 10:29     ` Andrzej Hajda
  -1 siblings, 0 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-07-05 10:29 UTC (permalink / raw)
  To: Dan Carpenter, Thierry Reding; +Cc: David Airlie, kernel-janitors, dri-devel

On 04.07.2018 11:38, Dan Carpenter wrote:
> The ARRAY_SIZE() macro is type size_t.  If s6e8aa0_dcs_read() returns a
> negative error code, then "ret < ARRAY_SIZE(id)" is false because the
> negative error code is type promoted to a high positive value.
>
> Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> index a188a3959f1a..6ad827b93ae1 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> @@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
>  	int ret, i;
>  
>  	ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
> -	if (ret < ARRAY_SIZE(id) || id[0] = 0x00) {
> +	if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] = 0x00) {
>  		dev_err(ctx->dev, "read id failed\n");
>  		ctx->error = -EIO;
>  		return;
>
>
>

Thanks for the fix.


Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

 --
Regards
Andrzej

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
@ 2018-07-05 10:29     ` Andrzej Hajda
  0 siblings, 0 replies; 6+ messages in thread
From: Andrzej Hajda @ 2018-07-05 10:29 UTC (permalink / raw)
  To: Dan Carpenter, Thierry Reding; +Cc: David Airlie, kernel-janitors, dri-devel

On 04.07.2018 11:38, Dan Carpenter wrote:
> The ARRAY_SIZE() macro is type size_t.  If s6e8aa0_dcs_read() returns a
> negative error code, then "ret < ARRAY_SIZE(id)" is false because the
> negative error code is type promoted to a high positive value.
>
> Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> index a188a3959f1a..6ad827b93ae1 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> @@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
>  	int ret, i;
>  
>  	ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
> -	if (ret < ARRAY_SIZE(id) || id[0] == 0x00) {
> +	if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) {
>  		dev_err(ctx->dev, "read id failed\n");
>  		ctx->error = -EIO;
>  		return;
>
>
>

Thanks for the fix.


Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

 --
Regards
Andrzej

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

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

* Re: [PATCH] drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
  2018-07-04  9:38   ` Dan Carpenter
@ 2018-07-10 11:12     ` Thierry Reding
  -1 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2018-07-10 11:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: David Airlie, kernel-janitors, dri-devel

[-- Attachment #1: Type: text/plain, Size: 429 bytes --]

On Wed, Jul 04, 2018 at 12:38:09PM +0300, Dan Carpenter wrote:
> The ARRAY_SIZE() macro is type size_t.  If s6e8aa0_dcs_read() returns a
> negative error code, then "ret < ARRAY_SIZE(id)" is false because the
> negative error code is type promoted to a high positive value.
> 
> Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.

Thierry

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

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

* Re: [PATCH] drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
@ 2018-07-10 11:12     ` Thierry Reding
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2018-07-10 11:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: David Airlie, kernel-janitors, dri-devel


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

On Wed, Jul 04, 2018 at 12:38:09PM +0300, Dan Carpenter wrote:
> The ARRAY_SIZE() macro is type size_t.  If s6e8aa0_dcs_read() returns a
> negative error code, then "ret < ARRAY_SIZE(id)" is false because the
> negative error code is type promoted to a high positive value.
> 
> Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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] 6+ messages in thread

end of thread, other threads:[~2018-07-10 11:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180704093825epcas5p3942c2cb6586f11a2f6607cd8fc9492a6@epcas5p3.samsung.com>
2018-07-04  9:38 ` [PATCH] drm/panel: type promotion bug in s6e8aa0_read_mtp_id() Dan Carpenter
2018-07-04  9:38   ` Dan Carpenter
2018-07-05 10:29   ` Andrzej Hajda
2018-07-05 10:29     ` Andrzej Hajda
2018-07-10 11:12   ` Thierry Reding
2018-07-10 11:12     ` Thierry Reding

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.