All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: mm/sparse.c:145:2: warning: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn]
Date: Tue, 13 Jul 2021 03:19:06 +0800	[thread overview]
Message-ID: <202107130348.6LsVT9Nc-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2044 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e73f0f0ee7541171d89f2e2491130c7771ba58d3
commit: 36d40290c8f71daf1ba5567ab14574f36b9b8d6a alpha: switch from DISCONTIGMEM to SPARSEMEM
date:   7 months ago
compiler: alpha-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)
>> mm/sparse.c:145:2: warning: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn]
    return (nid << SECTION_NID_SHIFT);
    ^

vim +145 mm/sparse.c

4ca644d970bf25 Dave Hansen    2005-10-29  136  
30c253e6da655d Andy Whitcroft 2006-06-23  137  /*
30c253e6da655d Andy Whitcroft 2006-06-23  138   * During early boot, before section_mem_map is used for an actual
30c253e6da655d Andy Whitcroft 2006-06-23  139   * mem_map, we use section_mem_map to store the section's NUMA
30c253e6da655d Andy Whitcroft 2006-06-23  140   * node.  This keeps us from having to use another data structure.  The
30c253e6da655d Andy Whitcroft 2006-06-23  141   * node information is cleared just before we store the real mem_map.
30c253e6da655d Andy Whitcroft 2006-06-23  142   */
30c253e6da655d Andy Whitcroft 2006-06-23  143  static inline unsigned long sparse_encode_early_nid(int nid)
30c253e6da655d Andy Whitcroft 2006-06-23  144  {
30c253e6da655d Andy Whitcroft 2006-06-23 @145  	return (nid << SECTION_NID_SHIFT);
30c253e6da655d Andy Whitcroft 2006-06-23  146  }
30c253e6da655d Andy Whitcroft 2006-06-23  147  

:::::: The code@line 145 was first introduced by commit
:::::: 30c253e6da655d73eb8bfe2adca9b8f4d82fb81e [PATCH] sparsemem: record nid during memory present

:::::: TO: Andy Whitcroft <apw@shadowen.org>
:::::: CC: Linus Torvalds <torvalds@g5.osdl.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Mike Rapoport <rppt@linux.ibm.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: mm/sparse.c:145:2: warning: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn]
Date: Tue, 13 Jul 2021 03:19:06 +0800	[thread overview]
Message-ID: <202107130348.6LsVT9Nc-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e73f0f0ee7541171d89f2e2491130c7771ba58d3
commit: 36d40290c8f71daf1ba5567ab14574f36b9b8d6a alpha: switch from DISCONTIGMEM to SPARSEMEM
date:   7 months ago
compiler: alpha-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)
>> mm/sparse.c:145:2: warning: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn]
    return (nid << SECTION_NID_SHIFT);
    ^

vim +145 mm/sparse.c

4ca644d970bf25 Dave Hansen    2005-10-29  136  
30c253e6da655d Andy Whitcroft 2006-06-23  137  /*
30c253e6da655d Andy Whitcroft 2006-06-23  138   * During early boot, before section_mem_map is used for an actual
30c253e6da655d Andy Whitcroft 2006-06-23  139   * mem_map, we use section_mem_map to store the section's NUMA
30c253e6da655d Andy Whitcroft 2006-06-23  140   * node.  This keeps us from having to use another data structure.  The
30c253e6da655d Andy Whitcroft 2006-06-23  141   * node information is cleared just before we store the real mem_map.
30c253e6da655d Andy Whitcroft 2006-06-23  142   */
30c253e6da655d Andy Whitcroft 2006-06-23  143  static inline unsigned long sparse_encode_early_nid(int nid)
30c253e6da655d Andy Whitcroft 2006-06-23  144  {
30c253e6da655d Andy Whitcroft 2006-06-23 @145  	return (nid << SECTION_NID_SHIFT);
30c253e6da655d Andy Whitcroft 2006-06-23  146  }
30c253e6da655d Andy Whitcroft 2006-06-23  147  

:::::: The code at line 145 was first introduced by commit
:::::: 30c253e6da655d73eb8bfe2adca9b8f4d82fb81e [PATCH] sparsemem: record nid during memory present

:::::: TO: Andy Whitcroft <apw@shadowen.org>
:::::: CC: Linus Torvalds <torvalds@g5.osdl.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


             reply	other threads:[~2021-07-12 19:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 19:19 kernel test robot [this message]
2021-07-12 19:19 ` mm/sparse.c:145:2: warning: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn] kernel test robot
2021-07-12 19:41 ` Matthew Wilcox
2021-07-12 19:41   ` Matthew Wilcox

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=202107130348.6LsVT9Nc-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.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.