All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patchwork <patchwork@emeril.freedesktop.org>
To: "Gwan-gyeong Mun" <gwan-gyeong.mun@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for overflow: Introduce overflows_type() and castable_to_type() (rev4)
Date: Tue, 25 Oct 2022 00:31:07 -0000	[thread overview]
Message-ID: <166665786754.15485.13227639957306143342@emeril.freedesktop.org> (raw)
In-Reply-To: <20220926191109.1803094-1-keescook@chromium.org>

== Series Details ==

Series: overflow: Introduce overflows_type() and castable_to_type() (rev4)
URL   : https://patchwork.freedesktop.org/series/109076/
State : warning

== Summary ==

Error: dim checkpatch failed
9f9dcc2b4db8 overflow: Introduce overflows_type() and castable_to_type()
-:88: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'x' - possible side-effects?
#88: FILE: include/linux/overflow.h:130:
+#define __overflows_type_constexpr(x, T) (			\
+	is_unsigned_type(typeof(x)) ?				\
+		(x) > type_max(typeof(T)) ? 1 : 0		\
+	: is_unsigned_type(typeof(T)) ?				\
+		(x) < 0 || (x) > type_max(typeof(T)) ? 1 : 0	\
+		: (x) < type_min(typeof(T)) ||			\
+		  (x) > type_max(typeof(T)) ? 1 : 0)

-:89: CHECK:SPACING: No space is necessary after a cast
#89: FILE: include/linux/overflow.h:131:
+	is_unsigned_type(typeof(x)) ?				\

-:90: CHECK:SPACING: No space is necessary after a cast
#90: FILE: include/linux/overflow.h:132:
+		(x) > type_max(typeof(T)) ? 1 : 0		\

-:91: CHECK:SPACING: No space is necessary after a cast
#91: FILE: include/linux/overflow.h:133:
+	: is_unsigned_type(typeof(T)) ?				\

-:92: CHECK:SPACING: No space is necessary after a cast
#92: FILE: include/linux/overflow.h:134:
+		(x) < 0 || (x) > type_max(typeof(T)) ? 1 : 0	\

-:93: CHECK:SPACING: No space is necessary after a cast
#93: FILE: include/linux/overflow.h:135:
+		: (x) < type_min(typeof(T)) ||			\

-:94: CHECK:SPACING: No space is necessary after a cast
#94: FILE: include/linux/overflow.h:136:
+		  (x) > type_max(typeof(T)) ? 1 : 0)

-:115: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?
#115: FILE: include/linux/overflow.h:157:
+#define overflows_type(n, T)					\
+	__builtin_choose_expr(__is_constexpr(n),		\
+			      __overflows_type_constexpr(n, T),	\
+			      __overflows_type(n, T))

-:115: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'T' - possible side-effects?
#115: FILE: include/linux/overflow.h:157:
+#define overflows_type(n, T)					\
+	__builtin_choose_expr(__is_constexpr(n),		\
+			      __overflows_type_constexpr(n, T),	\
+			      __overflows_type(n, T))

-:131: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?
#131: FILE: include/linux/overflow.h:173:
+#define castable_to_type(n, T)						\
+	__builtin_choose_expr(__is_constexpr(n),			\
+			      !__overflows_type_constexpr(n, T),	\
+			      __same_type(n, T))

-:131: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'T' - possible side-effects?
#131: FILE: include/linux/overflow.h:173:
+#define castable_to_type(n, T)						\
+	__builtin_choose_expr(__is_constexpr(n),			\
+			      !__overflows_type_constexpr(n, T),	\
+			      __same_type(n, T))

-:176: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'of' - possible side-effects?
#176: FILE: lib/overflow_kunit.c:716:
+#define __TEST_OVERFLOWS_TYPE(func, arg1, arg2, of)	do {		\
+	bool __of = func(arg1, arg2);					\
+	KUNIT_EXPECT_EQ_MSG(test, __of, of,				\
+		"expected " #func "(" #arg1 ", " #arg2 " to%s overflow\n",\
+		of ? "" : " not");					\
+	count++;							\
+} while (0)

-:185: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__t2' - possible side-effects?
#185: FILE: lib/overflow_kunit.c:725:
+#define TEST_OVERFLOWS_TYPE(__t1, __t2, v, of) do {			\
+	__t1 t1 = (v);							\
+	__t2 t2;							\
+	__TEST_OVERFLOWS_TYPE(__overflows_type, t1, t2, of);		\
+	__TEST_OVERFLOWS_TYPE(__overflows_type, t1, __t2, of);		\
+	__TEST_OVERFLOWS_TYPE(__overflows_type_constexpr, t1, t2, of);	\
+	__TEST_OVERFLOWS_TYPE(__overflows_type_constexpr, t1, __t2, of);\
+} while (0)

-:185: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'of' - possible side-effects?
#185: FILE: lib/overflow_kunit.c:725:
+#define TEST_OVERFLOWS_TYPE(__t1, __t2, v, of) do {			\
+	__t1 t1 = (v);							\
+	__t2 t2;							\
+	__TEST_OVERFLOWS_TYPE(__overflows_type, t1, t2, of);		\
+	__TEST_OVERFLOWS_TYPE(__overflows_type, t1, __t2, of);		\
+	__TEST_OVERFLOWS_TYPE(__overflows_type_constexpr, t1, t2, of);	\
+	__TEST_OVERFLOWS_TYPE(__overflows_type_constexpr, t1, __t2, of);\
+} while (0)

-:388: CHECK:MACRO_ARG_REUSE: Macro argument reuse 't1' - possible side-effects?
#388: FILE: lib/overflow_kunit.c:928:
+#define TEST_SAME_TYPE(t1, t2, same)			do {	\
+	typeof(t1) __t1h = type_max(t1);			\
+	typeof(t1) __t1l = type_min(t1);			\
+	typeof(t2) __t2h = type_max(t2);			\
+	typeof(t2) __t2l = type_min(t2);			\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t1, __t1h));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t1, __t1l));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t1h, t1));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t1l, t1));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t2, __t2h));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t2, __t2l));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t2h, t2));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t2l, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t2, __t1h));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t2, __t1l));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t1h, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t1l, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, __t2h));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, __t2l));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t2h, t1));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t2l, t1));	\
+} while (0)

-:388: CHECK:MACRO_ARG_REUSE: Macro argument reuse 't2' - possible side-effects?
#388: FILE: lib/overflow_kunit.c:928:
+#define TEST_SAME_TYPE(t1, t2, same)			do {	\
+	typeof(t1) __t1h = type_max(t1);			\
+	typeof(t1) __t1l = type_min(t1);			\
+	typeof(t2) __t2h = type_max(t2);			\
+	typeof(t2) __t2l = type_min(t2);			\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t1, __t1h));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t1, __t1l));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t1h, t1));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t1l, t1));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t2, __t2h));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t2, __t2l));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t2h, t2));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t2l, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t2, __t1h));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t2, __t1l));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t1h, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t1l, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, __t2h));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, __t2l));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t2h, t1));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t2l, t1));	\
+} while (0)

-:388: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'same' - possible side-effects?
#388: FILE: lib/overflow_kunit.c:928:
+#define TEST_SAME_TYPE(t1, t2, same)			do {	\
+	typeof(t1) __t1h = type_max(t1);			\
+	typeof(t1) __t1l = type_min(t1);			\
+	typeof(t2) __t2h = type_max(t2);			\
+	typeof(t2) __t2l = type_min(t2);			\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t1, __t1h));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t1, __t1l));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t1h, t1));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t1l, t1));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t2, __t2h));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(t2, __t2l));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t2h, t2));	\
+	KUNIT_EXPECT_EQ(test, true, __same_type(__t2l, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t2, __t1h));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t2, __t1l));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t1h, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t1l, t2));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, __t2h));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(t1, __t2l));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t2h, t1));	\
+	KUNIT_EXPECT_EQ(test, same, __same_type(__t2l, t1));	\
+} while (0)

-:418: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'base' - possible side-effects?
#418: FILE: lib/overflow_kunit.c:958:
+#define TEST_TYPE_SETS(base, mu8, mu16, mu32, ms8, ms16, ms32, mu64, ms64) \
+do {									\
+	TEST_SAME_TYPE(base,  u8,  mu8);				\
+	TEST_SAME_TYPE(base, u16, mu16);				\
+	TEST_SAME_TYPE(base, u32, mu32);				\
+	TEST_SAME_TYPE(base,  s8,  ms8);				\
+	TEST_SAME_TYPE(base, s16, ms16);				\
+	TEST_SAME_TYPE(base, s32, ms32);				\
+	TEST_SAME_TYPE64(base, u64, mu64);				\
+	TEST_SAME_TYPE64(base, s64, ms64);				\
+} while (0)

-:462: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'pass' - possible side-effects?
#462: FILE: lib/overflow_kunit.c:1002:
+#define TEST_CASTABLE_TO_TYPE(arg1, arg2, pass)	do {	\
+	bool __pass = castable_to_type(arg1, arg2);		\
+	KUNIT_EXPECT_EQ_MSG(test, __pass, pass,			\
+		"expected castable_to_type(" #arg1 ", " #arg2 ") to%s pass\n",\
+		pass ? "" : " not");				\
+	count++;						\
+} while (0)

total: 0 errors, 0 warnings, 19 checks, 490 lines checked



  parent reply	other threads:[~2022-10-25  0:31 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 19:11 [PATCH v2] overflow: Introduce overflows_type() and castable_to_type() Kees Cook
2022-09-26 19:11 ` [Intel-gfx] " Kees Cook
2022-09-26 19:11 ` Kees Cook
2022-09-26 20:17 ` Nick Desaulniers
2022-09-26 20:17   ` [Intel-gfx] " Nick Desaulniers
2022-09-26 20:17   ` Nick Desaulniers
2022-09-26 21:07   ` Kees Cook
2022-09-26 21:07     ` [Intel-gfx] " Kees Cook
2022-09-26 21:07     ` Kees Cook
2022-09-27  6:45     ` Arnd Bergmann
2022-09-27  6:45       ` [Intel-gfx] " Arnd Bergmann
2022-09-27  6:45       ` Arnd Bergmann
2022-09-27  0:27 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
2022-09-27  8:29 ` [PATCH v2] " Gwan-gyeong Mun
2022-09-27  8:29   ` [Intel-gfx] " Gwan-gyeong Mun
2022-09-27  8:29   ` Gwan-gyeong Mun
2022-09-27 23:36 ` [Intel-gfx] " kernel test robot
2022-09-27 23:36   ` kernel test robot
2022-09-27 23:36   ` kernel test robot
2022-09-28  8:19 ` Gwan-gyeong Mun
2022-09-28  8:19   ` [Intel-gfx] " Gwan-gyeong Mun
2022-09-28  8:19   ` Gwan-gyeong Mun
2022-09-29  3:24 ` [Intel-gfx] " kernel test robot
2022-09-29  3:24   ` kernel test robot
2022-09-29  3:24   ` kernel test robot
2022-09-29  8:32 ` kernel test robot
2022-09-29  8:32   ` kernel test robot
2022-09-29  8:32   ` kernel test robot
2022-10-13  6:49 ` [PATCH v3] " Gwan-gyeong Mun
2022-10-13  6:49   ` Gwan-gyeong Mun
2022-10-13  6:49   ` [Intel-gfx] " Gwan-gyeong Mun
2022-10-13  8:12   ` Jani Nikula
2022-10-13  8:12     ` [Intel-gfx] " Jani Nikula
2022-10-13  8:12     ` Jani Nikula
2022-10-13  8:17 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for overflow: Introduce overflows_type() and castable_to_type() (rev2) Patchwork
2022-10-21  8:33 ` [PATCH v4] overflow: Introduce overflows_type() and castable_to_type() Gwan-gyeong Mun
2022-10-21  8:33   ` [Intel-gfx] " Gwan-gyeong Mun
2022-10-21  8:33   ` Gwan-gyeong Mun
2022-10-21 16:06   ` Nathan Chancellor
2022-10-21 16:06     ` [Intel-gfx] " Nathan Chancellor
2022-10-21 16:06     ` Nathan Chancellor
2022-10-21 12:29 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for overflow: Introduce overflows_type() and castable_to_type() (rev3) Patchwork
2022-10-21 12:29 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-10-21 12:48 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-21 19:46 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-10-24 20:11 ` [PATCH v5] overflow: Introduce overflows_type() and castable_to_type() Gwan-gyeong Mun
2022-10-24 20:11   ` Gwan-gyeong Mun
2022-10-24 20:11   ` [Intel-gfx] " Gwan-gyeong Mun
2022-10-29  5:55   ` Gwan-gyeong Mun
2022-10-29  5:55     ` [Intel-gfx] " Gwan-gyeong Mun
2022-10-29  5:55     ` Gwan-gyeong Mun
2022-10-29  7:32     ` Kees Cook
2022-10-29  7:32       ` [Intel-gfx] " Kees Cook
2022-10-29  7:32       ` Kees Cook
2022-10-29  8:01       ` Gwan-gyeong Mun
2022-10-29  8:01         ` [Intel-gfx] " Gwan-gyeong Mun
2022-10-29  8:01         ` Gwan-gyeong Mun
2022-11-01 23:06         ` Kees Cook
2022-11-01 23:06           ` [Intel-gfx] " Kees Cook
2022-11-02 11:27           ` Gwan-gyeong Mun
2022-11-02 11:27             ` [Intel-gfx] " Gwan-gyeong Mun
2022-11-02 11:27             ` Gwan-gyeong Mun
2022-11-02 11:52   ` Rasmus Villemoes
2022-11-02 11:52     ` [Intel-gfx] " Rasmus Villemoes
2022-11-02 11:52     ` Rasmus Villemoes
2022-11-02 19:33     ` Kees Cook
2022-11-02 19:33       ` [Intel-gfx] " Kees Cook
2022-11-02 19:33       ` Kees Cook
2022-10-25  0:31 ` Patchwork [this message]
2022-10-25  0:31 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for overflow: Introduce overflows_type() and castable_to_type() (rev4) Patchwork
2022-10-25  0:53 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=166665786754.15485.13227639957306143342@emeril.freedesktop.org \
    --to=patchwork@emeril.freedesktop.org \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.