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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220427102206.GD2536@thinkpad>
Date:   Wed, 27 Apr 2022 15:52:06 +0530
From:   Manivannan Sadhasivam <mani@...nel.org>
To:     Wan Jiabing <wanjiabing@...o.com>
Cc:     Manivannan Sadhasivam <mani@...nel.org>,
        Hemant Kumar <quic_hemantk@...cinc.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jeffrey Hugo <quic_jhugo@...cinc.com>,
        Bhaumik Bhatt <bbhatt@...eaurora.org>,
        Paul Davey <paul.davey@...iedtelesis.co.nz>,
        Kees Cook <keescook@...omium.org>, mhi@...ts.linux.dev,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bus: mhi: replace snprintf with sysfs_emit

On Tue, Apr 26, 2022 at 08:58:59PM +0800, Wan Jiabing wrote:
> Fix following coccicheck warning:
> ./drivers/bus/mhi/host/init.c:89:8-16: WARNING: use scnprintf or sprintf
> 
> Use sysfs_emit and sysfs_emit_at instead of snprintf.
> 
> Signed-off-by: Wan Jiabing <wanjiabing@...o.com>

Reviewed-by: Manivannan Sadhasivam <mani@...nel.org>

Thanks,
Mani

> ---
>  drivers/bus/mhi/host/init.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c
> index cbb86b21063e..c137d55ccfa0 100644
> --- a/drivers/bus/mhi/host/init.c
> +++ b/drivers/bus/mhi/host/init.c
> @@ -86,7 +86,7 @@ static ssize_t serial_number_show(struct device *dev,
>  	struct mhi_device *mhi_dev = to_mhi_device(dev);
>  	struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
>  
> -	return snprintf(buf, PAGE_SIZE, "Serial Number: %u\n",
> +	return sysfs_emit(buf, "Serial Number: %u\n",
>  			mhi_cntrl->serial_number);
>  }
>  static DEVICE_ATTR_RO(serial_number);
> @@ -100,9 +100,8 @@ static ssize_t oem_pk_hash_show(struct device *dev,
>  	int i, cnt = 0;
>  
>  	for (i = 0; i < ARRAY_SIZE(mhi_cntrl->oem_pk_hash); i++)
> -		cnt += snprintf(buf + cnt, PAGE_SIZE - cnt,
> -				"OEMPKHASH[%d]: 0x%x\n", i,
> -				mhi_cntrl->oem_pk_hash[i]);
> +		cnt += sysfs_emit_at(buf, cnt, "OEMPKHASH[%d]: 0x%x\n",
> +				i, mhi_cntrl->oem_pk_hash[i]);
>  
>  	return cnt;
>  }
> -- 
> 2.35.3
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ