linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 2432/2827] fs/ntfs3/fslog.c:520:27: sparse: sparse: restricted __le32 degrades to integer
Date: Tue, 30 Jan 2024 21:56:56 +0800	[thread overview]
Message-ID: <202401302158.oKXhk0gV-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   41d66f96d0f15a0a2ad6fa2208f6bac1a66cbd52
commit: 1b7dd28e14c4728ae1a815605ca33ffb4ce1b309 [2432/2827] fs/ntfs3: Correct function is_rst_area_valid
config: x86_64-randconfig-121-20240130 (https://download.01.org/0day-ci/archive/20240130/202401302158.oKXhk0gV-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240130/202401302158.oKXhk0gV-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/202401302158.oKXhk0gV-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/ntfs3/fslog.c:520:27: sparse: sparse: restricted __le32 degrades to integer

vim +520 fs/ntfs3/fslog.c

   463	
   464	static inline bool is_rst_area_valid(const struct RESTART_HDR *rhdr)
   465	{
   466		const struct RESTART_AREA *ra;
   467		u16 cl, fl, ul;
   468		u32 off, l_size, seq_bits;
   469		u16 ro = le16_to_cpu(rhdr->ra_off);
   470		u32 sys_page = le32_to_cpu(rhdr->sys_page_size);
   471	
   472		if (ro + offsetof(struct RESTART_AREA, l_size) >
   473		    SECTOR_SIZE - sizeof(short))
   474			return false;
   475	
   476		ra = Add2Ptr(rhdr, ro);
   477		cl = le16_to_cpu(ra->log_clients);
   478	
   479		if (cl > 1)
   480			return false;
   481	
   482		off = le16_to_cpu(ra->client_off);
   483	
   484		if (!IS_ALIGNED(off, 8) || ro + off > SECTOR_SIZE - sizeof(short))
   485			return false;
   486	
   487		off += cl * sizeof(struct CLIENT_REC);
   488	
   489		if (off > sys_page)
   490			return false;
   491	
   492		/*
   493		 * Check the restart length field and whether the entire
   494		 * restart area is contained that length.
   495		 */
   496		if (le16_to_cpu(rhdr->ra_off) + le16_to_cpu(ra->ra_len) > sys_page ||
   497		    off > le16_to_cpu(ra->ra_len)) {
   498			return false;
   499		}
   500	
   501		/*
   502		 * As a final check make sure that the use list and the free list
   503		 * are either empty or point to a valid client.
   504		 */
   505		fl = le16_to_cpu(ra->client_idx[0]);
   506		ul = le16_to_cpu(ra->client_idx[1]);
   507		if ((fl != LFS_NO_CLIENT && fl >= cl) ||
   508		    (ul != LFS_NO_CLIENT && ul >= cl))
   509			return false;
   510	
   511		/* Make sure the sequence number bits match the log file size. */
   512		l_size = le64_to_cpu(ra->l_size);
   513	
   514		seq_bits = sizeof(u64) * 8 + 3;
   515		while (l_size) {
   516			l_size >>= 1;
   517			seq_bits -= 1;
   518		}
   519	
 > 520		if (seq_bits != ra->seq_num_bits)
   521			return false;
   522	
   523		/* The log page data offset and record header length must be quad-aligned. */
   524		if (!IS_ALIGNED(le16_to_cpu(ra->data_off), 8) ||
   525		    !IS_ALIGNED(le16_to_cpu(ra->rec_hdr_len), 8))
   526			return false;
   527	
   528		return true;
   529	}
   530	

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


                 reply	other threads:[~2024-01-30 13:57 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=202401302158.oKXhk0gV-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox