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: <20220114024453.D9F28C36AE3@smtp.kernel.org>
Date:   Thu, 13 Jan 2022 18:44:52 -0800
From:   Stephen Boyd <sboyd@...nel.org>
To:     Michael Turquette <mturquette@...libre.com>,
        Qing Wang <wangqing@...o.com>, linux-clk@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Robert Hancock <robert.hancock@...ian.com>
Cc:     mike.looijmans@...ic.nl, Qing Wang <wangqing@...o.com>
Subject: Re: [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit

+Robert

Quoting Qing Wang (2021-10-14 23:45:28)
> coccicheck complains about the use of snprintf() in sysfs show functions.
> 
> Fix the following coccicheck warning:
> drivers/clk/clk-si5341.c:1471: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1486: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1501: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1516: WARNING: use scnprintf or sprintf.
> 
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
> 
> Signed-off-by: Qing Wang <wangqing@...o.com>
> ---
>  drivers/clk/clk-si5341.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
> index 57ae183..5d62ddb 100644
> --- a/drivers/clk/clk-si5341.c
> +++ b/drivers/clk/clk-si5341.c
> @@ -1468,7 +1468,7 @@ static ssize_t input_present_show(struct device *dev,
>         if (res < 0)
>                 return res;
>         res = !(status & SI5341_STATUS_LOSREF);
> -       return snprintf(buf, PAGE_SIZE, "%d\n", res);
> +       return sysfs_emit(buf, "%d\n", res);
>  }
>  static DEVICE_ATTR_RO(input_present);
>  
> @@ -1483,7 +1483,7 @@ static ssize_t input_present_sticky_show(struct device *dev,
>         if (res < 0)
>                 return res;
>         res = !(status & SI5341_STATUS_LOSREF);
> -       return snprintf(buf, PAGE_SIZE, "%d\n", res);
> +       return sysfs_emit(buf, "%d\n", res);
>  }
>  static DEVICE_ATTR_RO(input_present_sticky);
>  
> @@ -1498,7 +1498,7 @@ static ssize_t pll_locked_show(struct device *dev,
>         if (res < 0)
>                 return res;
>         res = !(status & SI5341_STATUS_LOL);
> -       return snprintf(buf, PAGE_SIZE, "%d\n", res);
> +       return sysfs_emit(buf, "%d\n", res);
>  }
>  static DEVICE_ATTR_RO(pll_locked);
>  
> @@ -1513,7 +1513,7 @@ static ssize_t pll_locked_sticky_show(struct device *dev,
>         if (res < 0)
>                 return res;
>         res = !(status & SI5341_STATUS_LOL);
> -       return snprintf(buf, PAGE_SIZE, "%d\n", res);
> +       return sysfs_emit(buf, "%d\n", res);
>  }
>  static DEVICE_ATTR_RO(pll_locked_sticky);
>  
> -- 
> 2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ