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]
Date:   Thu, 14 Oct 2021 09:51:58 -0700
From:   Joe Perches <joe@...ches.com>
To:     Qing Wang <wangqing@...o.com>,
        "Darrick J. Wong" <djwong@...nel.org>, linux-xfs@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] xfs: replace snprintf in show functions with sysfs_emit

On Tue, 2021-10-12 at 20:29 -0700, Qing Wang wrote:
> coccicheck complains about the use of snprintf() in sysfs show functions.
> 
> Fix the coccicheck warning:
> WARNING: use scnprintf or sprintf.
> 
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
[]
> diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
[]
> @@ -104,7 +104,7 @@ bug_on_assert_show(
>  	struct kobject		*kobject,
>  	char			*buf)
>  {
> -	return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.bug_on_assert ? 1 : 0);
> +	return sysfs_emit(buf, "%d\n", xfs_globals.bug_on_assert ? 1 : 0);

trivia:

The ?: is not necessary as xfs_globals.bug_on_assert is a bool
and would have an implicit cast done.

	return sysfs_emit(buf, "%d\n", xfs_globals.bug_on_assert);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ