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: <855fdeec-c590-4fef-b917-ced3ec39ab3a@intel.com>
Date: Wed, 7 Feb 2024 10:11:38 +0200
From: Adrian Hunter <adrian.hunter@...el.com>
To: Li Zhijian <lizhijian@...itsu.com>, linux-kernel@...r.kernel.org
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
 Arnaldo Carvalho de Melo <acme@...nel.org>,
 Mark Rutland <mark.rutland@....com>,
 Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
 Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
 Ian Rogers <irogers@...gle.com>, Thomas Gleixner <tglx@...utronix.de>,
 Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
 x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
 linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v2 3/4] arch/x86/events/core: use scnprintf to print
 sub-string

On 26/01/24 08:13, Li Zhijian wrote:
> sysfs_emit is not suitable to to print a substring, convert it to scnprintf

'to to' -> 'to'

> to make coccicheck happy.
> 
> CC: Peter Zijlstra <peterz@...radead.org>
> CC: Ingo Molnar <mingo@...hat.com>
> CC: Arnaldo Carvalho de Melo <acme@...nel.org>
> CC: Mark Rutland <mark.rutland@....com>
> CC: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> CC: Jiri Olsa <jolsa@...nel.org>
> CC: Namhyung Kim <namhyung@...nel.org>
> CC: Ian Rogers <irogers@...gle.com>
> CC: Adrian Hunter <adrian.hunter@...el.com>
> CC: Thomas Gleixner <tglx@...utronix.de>
> CC: Borislav Petkov <bp@...en8.de>
> CC: Dave Hansen <dave.hansen@...ux.intel.com>
> CC: x86@...nel.org
> CC: "H. Peter Anvin" <hpa@...or.com>
> CC: linux-perf-users@...r.kernel.org
> Signed-off-by: Li Zhijian <lizhijian@...itsu.com>

Reviewed-by: Adrian Hunter <adrian.hunter@...el.com>

> ---
> V2: new patch address coccinelle warning
> ---
>  arch/x86/events/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index 20d963196e4c..5ed2ba16c6c0 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -1892,7 +1892,7 @@ ssize_t events_hybrid_sysfs_show(struct device *dev,
>  		if (x86_pmu.hybrid_pmu[i].pmu_type & pmu->pmu_type) {
>  			next_str = strchr(str, ';');
>  			if (next_str)
> -				return snprintf(page, next_str - str + 1, "%s", str);
> +				return scnprintf(page, next_str - str + 1, "%s", str);
>  			else
>  				return sysfs_emit(page, "%s", str);
>  		}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ