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  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:   Mon, 20 Jan 2020 09:28:18 +0800
From:   tanhuazhong <tanhuazhong@...wei.com>
To:     Chen Zhou <chenzhou10@...wei.com>, <yisen.zhuang@...wei.com>,
        <salil.mehta@...wei.com>, <davem@...emloft.net>
CC:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] net: hns3: replace snprintf with scnprintf in
 hns3_dbg_cmd_read



On 2020/1/19 20:41, Chen Zhou wrote:
> The return value of snprintf may be greater than the size of
> HNS3_DBG_READ_LEN, use scnprintf instead in hns3_dbg_cmd_read.
> 
> Signed-off-by: Chen Zhou <chenzhou10@...wei.com>
> ---
>   drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
> index 6b328a2..8fad699 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
> @@ -297,7 +297,7 @@ static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer,
>   	if (!buf)
>   		return -ENOMEM;
>   
> -	len = snprintf(buf, HNS3_DBG_READ_LEN, "%s\n",
> +	len = scnprintf(buf, HNS3_DBG_READ_LEN, "%s\n",
>   		       "Please echo help to cmd to get help information");

not align?

>   	uncopy_bytes = copy_to_user(buffer, buf, len);
>   
> 

Powered by blists - more mailing lists