All of lore.kernel.org
 help / color / mirror / Atom feed
From: maxime.ripard@bootlin.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer
Date: Thu, 4 Oct 2018 21:54:06 +0200	[thread overview]
Message-ID: <20181004195406.prjuko556tnuau2u@flea> (raw)
In-Reply-To: <20181003142458.33120-1-giulio.benetti@micronovasrl.com>

Hi,

On Wed, Oct 03, 2018 at 04:24:57PM +0200, Giulio Benetti wrote:
> At the moment, the check of tcon->panel to be valid is wrong. IS_ERR()
> has been used, but that macro doesn't check if tcon->panel pointer is
> null or not, but check if tcon->panel is between -1 and -4095(MAX_ERRNO).
> 
> Remove IS_ERR() from tcon->panel checking and let "if (tcon->panel)" as
> condition to check if it's a pointer not null.
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>

The commit log should be improved. The issue isn't really with the
IS_ERR macro as you suggest, but that what is returned by
of_drm_find_panel, and thus stored in tcon->panel. is not an error
pointer in the first place but a NULL pointer on error. So the check
doesn't check for the proper thing.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181004/5728b4a0/attachment.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Giulio Benetti <giulio.benetti@micronovasrl.com>
Cc: David Airlie <airlied@linux.ie>, Chen-Yu Tsai <wens@csie.org>,
	linux-arm-kernel@lists.infradead.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer
Date: Thu, 4 Oct 2018 21:54:06 +0200	[thread overview]
Message-ID: <20181004195406.prjuko556tnuau2u@flea> (raw)
In-Reply-To: <20181003142458.33120-1-giulio.benetti@micronovasrl.com>


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

Hi,

On Wed, Oct 03, 2018 at 04:24:57PM +0200, Giulio Benetti wrote:
> At the moment, the check of tcon->panel to be valid is wrong. IS_ERR()
> has been used, but that macro doesn't check if tcon->panel pointer is
> null or not, but check if tcon->panel is between -1 and -4095(MAX_ERRNO).
> 
> Remove IS_ERR() from tcon->panel checking and let "if (tcon->panel)" as
> condition to check if it's a pointer not null.
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>

The commit log should be improved. The issue isn't really with the
IS_ERR macro as you suggest, but that what is returned by
of_drm_find_panel, and thus stored in tcon->panel. is not an error
pointer in the first place but a NULL pointer on error. So the check
doesn't check for the proper thing.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- 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

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Giulio Benetti <giulio.benetti@micronovasrl.com>
Cc: David Airlie <airlied@linux.ie>, Chen-Yu Tsai <wens@csie.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer
Date: Thu, 4 Oct 2018 21:54:06 +0200	[thread overview]
Message-ID: <20181004195406.prjuko556tnuau2u@flea> (raw)
In-Reply-To: <20181003142458.33120-1-giulio.benetti@micronovasrl.com>

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

Hi,

On Wed, Oct 03, 2018 at 04:24:57PM +0200, Giulio Benetti wrote:
> At the moment, the check of tcon->panel to be valid is wrong. IS_ERR()
> has been used, but that macro doesn't check if tcon->panel pointer is
> null or not, but check if tcon->panel is between -1 and -4095(MAX_ERRNO).
> 
> Remove IS_ERR() from tcon->panel checking and let "if (tcon->panel)" as
> condition to check if it's a pointer not null.
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>

The commit log should be improved. The issue isn't really with the
IS_ERR macro as you suggest, but that what is returned by
of_drm_find_panel, and thus stored in tcon->panel. is not an error
pointer in the first place but a NULL pointer on error. So the check
doesn't check for the proper thing.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

  parent reply	other threads:[~2018-10-04 19:54 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01  9:36 [bug report] drm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE checking if panel is used Dan Carpenter
2018-10-02 13:26 ` Giulio Benetti
2018-10-02 14:12   ` Giulio Benetti
2018-10-02 20:40     ` Giulio Benetti
2018-10-11  7:16   ` Dan Carpenter
2018-10-11 21:36     ` Giulio Benetti
2018-10-02 20:48 ` [PATCH 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Giulio Benetti
2018-10-02 20:48   ` Giulio Benetti
2018-10-02 20:49   ` [PATCH 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if null Giulio Benetti
2018-10-02 20:49     ` Giulio Benetti
2018-10-02 21:59 ` [PATCH 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Giulio Benetti
2018-10-02 21:59   ` Giulio Benetti
2018-10-02 21:59   ` Giulio Benetti
2018-10-02 21:59   ` [PATCH 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if null Giulio Benetti
2018-10-02 21:59     ` Giulio Benetti
2018-10-03  7:34     ` Chen-Yu Tsai
2018-10-03  7:34       ` Chen-Yu Tsai
2018-10-02 22:00   ` [PATCH 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Giulio Benetti
2018-10-02 22:00     ` Giulio Benetti
2018-10-02 22:00     ` Giulio Benetti
2018-10-03  9:43   ` Chen-Yu Tsai
2018-10-03  9:43     ` Chen-Yu Tsai
2018-10-03 12:13     ` Giulio Benetti
2018-10-03 12:13       ` Giulio Benetti
2018-10-03 14:24       ` [PATCH v2 " Giulio Benetti
2018-10-03 14:24         ` Giulio Benetti
2018-10-03 14:24         ` [PATCH v2 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if null Giulio Benetti
2018-10-03 14:24           ` Giulio Benetti
2018-10-03 14:24           ` Giulio Benetti
2018-10-04 19:56           ` Maxime Ripard
2018-10-04 19:56             ` Maxime Ripard
2018-10-04 19:56             ` Maxime Ripard
2018-10-05 21:38             ` Giulio Benetti
2018-10-05 21:38               ` Giulio Benetti
2018-10-05 21:59             ` [PATCH v3 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Giulio Benetti
2018-10-05 21:59               ` Giulio Benetti
2018-10-05 21:59               ` Giulio Benetti
2018-10-05 21:59               ` [PATCH v3 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if NULL Giulio Benetti
2018-10-05 21:59                 ` Giulio Benetti
2018-10-08  9:21                 ` Maxime Ripard
2018-10-08  9:21                   ` Maxime Ripard
2018-10-12 10:03                   ` Chen-Yu Tsai
2018-10-12 10:03                     ` Chen-Yu Tsai
2018-11-05 13:23                   ` Icenowy Zheng
2018-11-05 13:23                     ` Icenowy Zheng
2018-11-06 15:57                     ` Maxime Ripard
2018-11-06 15:57                       ` Maxime Ripard
2018-10-04 19:54         ` Maxime Ripard [this message]
2018-10-04 19:54           ` [PATCH v2 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Maxime Ripard
2018-10-04 19:54           ` Maxime Ripard

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=20181004195406.prjuko556tnuau2u@flea \
    --to=maxime.ripard@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 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.