All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Thomas Weißschuh (Schneider Electric)"
	<thomas.weissschuh@linutronix.de>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [thomas-weissschuh:b4/auxclock-nanosleep 17/42] kernel/time/aux_clock_test.c:184:18: warning: integer overflow in expression of type 'long int' results in '705032704'
Date: Fri, 11 Sep 2026 15:59:09 +0800	[thread overview]
Message-ID: <202609111530.PtcoH3H4-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git b4/auxclock-nanosleep
head:   368883ddc7ac709883254193a4588fdf9b2da65a
commit: 05ab3171697e70cdc4302f27ef62d851a2580f93 [17/42] timekeeping: Add a test for auxiliary to monotonic clock conversions
config: arc-randconfig-002-20260911 (https://download.01.org/0day-ci/archive/20260911/202609111530.PtcoH3H4-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260911/202609111530.PtcoH3H4-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609111530.PtcoH3H4-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/time/aux_clock_test.c: In function 'mono_conv_edge_cases':
>> kernel/time/aux_clock_test.c:184:18: warning: integer overflow in expression of type 'long int' results in '705032704' [-Woverflow]
     small_delta = 5 * NSEC_PER_SEC;
                     ^
   kernel/time/aux_clock_test.c:186:28: warning: integer overflow in expression of type 'long int' results in '765657088' [-Woverflow]
     large_delta = 365 * 86400 * NSEC_PER_SEC;
                               ^


vim +184 kernel/time/aux_clock_test.c

   173	
   174	/* Mostly for development only. */
   175	static void mono_conv_edge_cases(struct kunit *test)
   176	{
   177		ktime_t mono_base, aux_base, small_delta, large_delta;
   178		struct tk_aux_mono_conv conv;
   179		ktime_t converted_mono;
   180		bool is_before;
   181	
   182		mono_base = 0;
   183		aux_base = 0;
 > 184		small_delta = 5 * NSEC_PER_SEC;
   185		/* 1 year */
   186		large_delta = 365 * 86400 * NSEC_PER_SEC;
   187	
   188		setup_aux_mono_conv(&conv, 5, mono_base, aux_base);
   189	
   190		/* delta = 0 */
   191		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base, mono_base, &converted_mono);
   192		KUNIT_EXPECT_FALSE(test, is_before);
   193	
   194		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base, mono_base + 1,
   195							      &converted_mono);
   196		KUNIT_EXPECT_TRUE(test, is_before);
   197		KUNIT_EXPECT_EQ(test, converted_mono, mono_base);
   198	
   199		/* positive small delta */
   200		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base + small_delta, mono_base,
   201							      &converted_mono);
   202		KUNIT_EXPECT_FALSE(test, is_before);
   203	
   204		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base, mono_base + small_delta,
   205							      &converted_mono);
   206		KUNIT_EXPECT_TRUE(test, is_before);
   207		KUNIT_EXPECT_EQ(test, converted_mono, mono_base);
   208	
   209		/* positive large delta */
   210		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base + large_delta, mono_base,
   211							      &converted_mono);
   212		KUNIT_EXPECT_FALSE(test, is_before);
   213	
   214		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base, mono_base + large_delta,
   215							      &converted_mono);
   216		KUNIT_EXPECT_TRUE(test, is_before);
   217		KUNIT_EXPECT_EQ(test, converted_mono, mono_base);
   218	
   219		/* negative small delta */
   220		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base - small_delta, mono_base,
   221							      &converted_mono);
   222		KUNIT_EXPECT_TRUE(test, is_before);
   223		KUNIT_EXPECT_EQ(test, converted_mono, -4761904702);
   224	
   225		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base, mono_base - small_delta,
   226							      &converted_mono);
   227		KUNIT_EXPECT_FALSE(test, is_before);
   228	
   229		/* negative large delta */
   230		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base - large_delta, mono_base,
   231							      &converted_mono);
   232		KUNIT_EXPECT_TRUE(test, is_before);
   233		KUNIT_EXPECT_EQ(test, converted_mono, -30034285333871842);
   234	
   235		is_before = ktime_aux_before_mono_and_convert(&conv, aux_base, mono_base - large_delta,
   236							      &converted_mono);
   237		KUNIT_EXPECT_FALSE(test, is_before);
   238	}
   239	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-09-11  8:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202609111530.PtcoH3H4-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=thomas.weissschuh@linutronix.de \
    /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.