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]
Message-ID: <8cdae251-f75e-bde8-a53d-27c77ac624c3@canonical.com>
Date:   Fri, 24 Sep 2021 10:03:27 -0600
From:   Tim Gardner <tim.gardner@...onical.com>
To:     dri-devel@...ts.freedesktop.org
Cc:     William Breathitt Gray <vilhelm.gray@...il.com>,
        Syed Nayyar Waris <syednwaris@...il.com>,
        Andrzej Hajda <a.hajda@...sung.com>,
        Neil Armstrong <narmstrong@...libre.com>,
        Robert Foss <robert.foss@...aro.org>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Jonas Karlman <jonas@...boo.se>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/bridge: parade-ps8640: check return values in
 ps8640_aux_transfer()



On 9/24/21 9:26 AM, Tim Gardner wrote:
> Coverity complains of an unused return code:
> 
> CID 120459 (#1 of 1): Unchecked return value (CHECKED_RETURN)
> 7. check_return: Calling regmap_bulk_write without checking return value (as is
> done elsewhere 199 out of 291 times).
> 204        regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len,
> 205                          ARRAY_SIZE(addr_len));
> 
> While I was at it I noticed 2 other places where return codes were not being
> used, or used incorrectly (which is a real bug).
> 
> Fix these errors by correctly using the returned error codes.
> 
> Cc: William Breathitt Gray <vilhelm.gray@...il.com>
> Cc: Syed Nayyar Waris <syednwaris@...il.com>
> Cc: Andrzej Hajda <a.hajda@...sung.com>
> Cc: Neil Armstrong <narmstrong@...libre.com>
> Cc: Robert Foss <robert.foss@...aro.org>
> Cc: Laurent Pinchart <Laurent.pinchart@...asonboard.com>
> Cc: Jonas Karlman <jonas@...boo.se>
> Cc: Jernej Skrabec <jernej.skrabec@...il.com>
> Cc: David Airlie <airlied@...ux.ie>
> Cc: Daniel Vetter <daniel@...ll.ch>
> Cc: linux-iio@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Cc: dri-devel@...ts.freedesktop.org
> Signed-off-by: Tim Gardner <tim.gardner@...onical.com>
> ---
>   drivers/gpu/drm/bridge/parade-ps8640.c | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
> index 3aaa90913bf8..591da962970a 100644
> --- a/drivers/gpu/drm/bridge/parade-ps8640.c
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -201,8 +201,12 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux,
>   	addr_len[PAGE0_SWAUX_LENGTH - base] = (len == 0) ? SWAUX_NO_PAYLOAD :
>   					      ((len - 1) & SWAUX_LENGTH_MASK);
>   
> -	regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len,
> +	ret = regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len,
>   			  ARRAY_SIZE(addr_len));
> +	if (ret) {
> +		DRM_DEV_ERROR(dev, "failed to bulk write ADDR_7_0: %d\n", ret);
> +		return ret;
> +	}
>   
>   	if (len && (request == DP_AUX_NATIVE_WRITE ||
>   		    request == DP_AUX_I2C_WRITE)) {
> @@ -218,13 +222,17 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux,
>   		}
>   	}
>   
> -	regmap_write(map, PAGE0_SWAUX_CTRL, SWAUX_SEND);
> +	ret = regmap_write(map, PAGE0_SWAUX_CTRL, SWAUX_SEND);
> +	if (ret) {
> +		DRM_DEV_ERROR(dev, "failed to write SEND: %d\n", ret);
> +		return ret;
> +	}
>   
>   	/* Zero delay loop because i2c transactions are slow already */
>   	regmap_read_poll_timeout(map, PAGE0_SWAUX_CTRL, data,
>   				 !(data & SWAUX_SEND), 0, 50 * 1000);
>   
> -	regmap_read(map, PAGE0_SWAUX_STATUS, &data);
> +	ret = regmap_read(map, PAGE0_SWAUX_STATUS, &data);
>   	if (ret) {
>   		DRM_DEV_ERROR(dev, "failed to read PAGE0_SWAUX_STATUS: %d\n",
>   			      ret);
> 

I forgot to mention this patch is for linux-next next-20210924.

-----------
Tim Gardner
Canonical, Inc

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ