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>] [day] [month] [year] [list]
Message-ID: <tip-tlt97p066zyhzqhl5jt86og7@git.kernel.org>
Date:   Fri, 14 Dec 2018 12:25:58 -0800
From:   tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     acme@...hat.com, alexander.shishkin@...ux.intel.com,
        peterz@...radead.org, namhyung@...nel.org, julia.lawall@...6.fr,
        linux-kernel@...r.kernel.org, jolsa@...nel.org, dsahern@...il.com,
        tglx@...utronix.de, hpa@...or.com, wangnan0@...wei.com,
        mingo@...nel.org, adrian.hunter@...el.com,
        yellowriver2010@...mail.com, dhowells@...hat.com
Subject: [tip:perf/core] tools include: Adopt ERR_CAST() from the kernel
 err.h header

Commit-ID:  c4838c7bad14c3cf6c779c24794044bc48b53002
Gitweb:     https://git.kernel.org/tip/c4838c7bad14c3cf6c779c24794044bc48b53002
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Tue, 27 Nov 2018 09:56:55 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 29 Nov 2018 20:42:48 -0300

tools include: Adopt ERR_CAST() from the kernel err.h header

Add ERR_CAST(), so that tools can use it, just like the kernel.

This addresses coccinelle checks that are being performed to tools/ in
addition to kernel sources, so lets add this to cover that and to get
tools code closer to kernel coding standards.

This originally was introduced in the kernel headers in this cset:

  d1bc8e954452 ("Add an ERR_CAST() function to complement ERR_PTR and co.")

Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: David Ahern <dsahern@...il.com>
Cc: David Howells <dhowells@...hat.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Julia Lawall <julia.lawall@...6.fr>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Wang Nan <wangnan0@...wei.com>
Cc: Wen Yang <yellowriver2010@...mail.com>
Cc: zhong.weidong@....com.cn
Link: https://lkml.kernel.org/n/tip-tlt97p066zyhzqhl5jt86og7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/include/linux/err.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/include/linux/err.h b/tools/include/linux/err.h
index 094649667bae..2f5a12b88a86 100644
--- a/tools/include/linux/err.h
+++ b/tools/include/linux/err.h
@@ -59,4 +59,17 @@ static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
 	else
 		return 0;
 }
+
+/**
+ * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
+ * @ptr: The pointer to cast.
+ *
+ * Explicitly cast an error-valued pointer to another pointer type in such a
+ * way as to make it clear that's what's going on.
+ */
+static inline void * __must_check ERR_CAST(__force const void *ptr)
+{
+	/* cast away the const */
+	return (void *) ptr;
+}
 #endif /* _LINUX_ERR_H */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ