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] [day] [month] [year] [list]
Message-ID: <20211015111139.ozarnvcdxscbaqv4@earth.universe>
Date:   Fri, 15 Oct 2021 13:11:39 +0200
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Qing Wang <wangqing@...o.com>
Cc:     Thierry Reding <thierry.reding@...il.com>,
        Sam Ravnborg <sam@...nborg.org>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm: panel: replace snprintf in show functions with
 sysfs_emit

Hi,

On Thu, Oct 14, 2021 at 11:48:10PM -0700, Qing Wang wrote:
> show() must not use snprintf() when formatting the value to be
> returned to user space.
> 
> Fix the following coccicheck warning:
> drivers/gpu/drm/panel/panel-dsi-cm.c:251: WARNING: use scnprintf or sprintf.
> drivers/gpu/drm/panel/panel-dsi-cm.c:271: WARNING: use scnprintf or sprintf.
> 
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
> 
> Signed-off-by: Qing Wang <wangqing@...o.com>
> ---

The patch subject could be more specific (this updates just one panel driver).
Otherwise:

Reviewed-by: Sebastian Reichel <sebastian.reichel@...labora.com>

-- Sebastian

>  drivers/gpu/drm/panel/panel-dsi-cm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c b/drivers/gpu/drm/panel/panel-dsi-cm.c
> index 5fbfb71..a8efb06 100644
> --- a/drivers/gpu/drm/panel/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
> @@ -248,7 +248,7 @@ static ssize_t num_dsi_errors_show(struct device *dev,
>  	if (r)
>  		return r;
>  
> -	return snprintf(buf, PAGE_SIZE, "%d\n", errors);
> +	return sysfs_emit(buf, "%d\n", errors);
>  }
>  
>  static ssize_t hw_revision_show(struct device *dev,
> @@ -268,7 +268,7 @@ static ssize_t hw_revision_show(struct device *dev,
>  	if (r)
>  		return r;
>  
> -	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
> +	return sysfs_emit(buf, "%02x.%02x.%02x\n", id1, id2, id3);
>  }
>  
>  static DEVICE_ATTR_RO(num_dsi_errors);
> -- 
> 2.7.4
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ