lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 06 Jun 2023 16:07:47 +0300
From:   Jani Nikula <jani.nikula@...ux.intel.com>
To:     Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Siddh Raman Pant <code@...dh.me>
Cc:     Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        Andrzej Hajda <andrzej.hajda@...el.com>,
        Neil Armstrong <neil.armstrong@...aro.org>,
        Robert Foss <rfoss@...nel.org>,
        Jonas Karlman <jonas@...boo.se>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        Suraj Upadhyay <usuraj35@...il.com>
Subject: Re: [PATCH v9 1/8] Revert "drm: mipi-dsi: Convert logging to drm_*
 functions."

On Tue, 06 Jun 2023, Laurent Pinchart <laurent.pinchart@...asonboard.com> wrote:
> Hi Siddh,
>
> Thank you for the patch.
>
> On Tue, Jun 06, 2023 at 04:15:15PM +0530, Siddh Raman Pant wrote:
>> This reverts commit 1040e424353f5f4d39f6f3aa8723eb3bd6ea6446.
>> 
>> It used an incorrect way to use drm_* functions. Only drm_device ptrs
>> should be passed, but the mentioned commit passed mipi_dsi_host ptr.
>> It worked by accident due to macro magic.
>> 
>> Reported-by: Jani Nikula <jani.nikula@...ux.intel.com>
>> Reviewed-by: Jani Nikula <jani.nikula@...el.com>
>> Signed-off-by: Siddh Raman Pant <code@...dh.me>
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
>
> Any chance we could prevent this from happening by turning the macros
> into inline functions ?

Patch 2 adds static inline struct device *__drm_dev_ptr(const struct
drm_device *drm) which should tackle this.

BR,
Jani.

>
>> ---
>>  drivers/gpu/drm/drm_mipi_dsi.c | 15 ++++++++-------
>>  1 file changed, 8 insertions(+), 7 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
>> index 3fd6c733ff4e..a37af4edf394 100644
>> --- a/drivers/gpu/drm/drm_mipi_dsi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
>> @@ -33,7 +33,6 @@
>>  
>>  #include <drm/display/drm_dsc.h>
>>  #include <drm/drm_mipi_dsi.h>
>> -#include <drm/drm_print.h>
>>  
>>  #include <video/mipi_display.h>
>>  
>> @@ -156,18 +155,19 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
>>  static struct mipi_dsi_device *
>>  of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
>>  {
>> +	struct device *dev = host->dev;
>>  	struct mipi_dsi_device_info info = { };
>>  	int ret;
>>  	u32 reg;
>>  
>>  	if (of_alias_from_compatible(node, info.type, sizeof(info.type)) < 0) {
>> -		drm_err(host, "modalias failure on %pOF\n", node);
>> +		dev_err(dev, "modalias failure on %pOF\n", node);
>>  		return ERR_PTR(-EINVAL);
>>  	}
>>  
>>  	ret = of_property_read_u32(node, "reg", &reg);
>>  	if (ret) {
>> -		drm_err(host, "device node %pOF has no valid reg property: %d\n",
>> +		dev_err(dev, "device node %pOF has no valid reg property: %d\n",
>>  			node, ret);
>>  		return ERR_PTR(-EINVAL);
>>  	}
>> @@ -202,21 +202,22 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>>  			      const struct mipi_dsi_device_info *info)
>>  {
>>  	struct mipi_dsi_device *dsi;
>> +	struct device *dev = host->dev;
>>  	int ret;
>>  
>>  	if (!info) {
>> -		drm_err(host, "invalid mipi_dsi_device_info pointer\n");
>> +		dev_err(dev, "invalid mipi_dsi_device_info pointer\n");
>>  		return ERR_PTR(-EINVAL);
>>  	}
>>  
>>  	if (info->channel > 3) {
>> -		drm_err(host, "invalid virtual channel: %u\n", info->channel);
>> +		dev_err(dev, "invalid virtual channel: %u\n", info->channel);
>>  		return ERR_PTR(-EINVAL);
>>  	}
>>  
>>  	dsi = mipi_dsi_device_alloc(host);
>>  	if (IS_ERR(dsi)) {
>> -		drm_err(host, "failed to allocate DSI device %ld\n",
>> +		dev_err(dev, "failed to allocate DSI device %ld\n",
>>  			PTR_ERR(dsi));
>>  		return dsi;
>>  	}
>> @@ -227,7 +228,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>>  
>>  	ret = mipi_dsi_device_add(dsi);
>>  	if (ret) {
>> -		drm_err(host, "failed to add DSI device %d\n", ret);
>> +		dev_err(dev, "failed to add DSI device %d\n", ret);
>>  		kfree(dsi);
>>  		return ERR_PTR(ret);
>>  	}
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ