All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [jgunthorpe:iommu_pt_all 41/56] drivers/iommu/generic_pt/fmt/../iommu_pt.h:735 __cut_mapping() warn: continue to end of do { ... } while(0); loop
Date: Sat, 30 Aug 2025 13:35:10 +0800	[thread overview]
Message-ID: <202508301321.c3GXwQnF-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Jason Gunthorpe <jgg@nvidia.com>

tree:   https://github.com/jgunthorpe/linux iommu_pt_all
head:   451e6e58d3fc7e3c1eb9a6d5bfb5d5da4b088133
commit: e3440a4e2ef96292c91a870405399bfcc197e973 [41/56] iommupt: Add cut_mapping op
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: powerpc-randconfig-r072-20250830 (https://download.01.org/0day-ci/archive/20250830/202508301321.c3GXwQnF-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project ac23f7465eedd0dd565ffb201f573e7a69695fa3)

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202508301321.c3GXwQnF-lkp@intel.com/

New smatch warnings:
drivers/iommu/generic_pt/fmt/../iommu_pt.h:735 __cut_mapping() warn: continue to end of do { ... } while(0); loop

Old smatch warnings:
drivers/iommu/generic_pt/fmt/../pt_defs.h:224 pt_feature() warn: bitwise AND condition is false here
drivers/iommu/generic_pt/fmt/../iommu_pt.h:180 pt_iommu_armv7s_iova_to_phys() warn: sizeof(NUMBER)?
drivers/iommu/generic_pt/fmt/../iommu_pt.h:321 armv7s_set_dirty() warn: sizeof(NUMBER)?
drivers/iommu/generic_pt/fmt/../iommu_pt.h:745 __cut_mapping() warn: continue to end of do { ... } while(0); loop
drivers/iommu/generic_pt/fmt/../iommu_pt.h:771 armv7s_cut_mapping() warn: sizeof(NUMBER)?
drivers/iommu/generic_pt/fmt/../iommu_pt.h:1054 increase_top() error: uninitialized symbol 'table_mem'.
drivers/iommu/generic_pt/fmt/../iommu_pt.h:1054 increase_top() error: uninitialized symbol 'new_level'.
drivers/iommu/generic_pt/fmt/../iommu_pt.h:1003 increase_top() warn: missing unwind goto?
drivers/iommu/generic_pt/fmt/../iommu_pt.h:1414 pt_init_common() warn: bitwise AND condition is false here

vim +735 drivers/iommu/generic_pt/fmt/../iommu_pt.h

e3440a4e2ef962 Jason Gunthorpe 2025-04-03  710  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  711  static int __cut_mapping(struct pt_range *range, void *arg, unsigned int level,
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  712  			 struct pt_table_p *table)
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  713  {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  714  	struct pt_state pts = pt_init(range, level, table);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  715  	const struct pt_write_attrs *cut_attrs = arg;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  716  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  717  	do {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  718  		switch (pt_load_single_entry(&pts)) {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  719  		case PT_ENTRY_EMPTY:
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  720  			return -ENOENT;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  721  		case PT_ENTRY_TABLE:
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  722  			return pt_descend(&pts, arg, __cut_mapping);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  723  		case PT_ENTRY_OA: {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  724  			int ret;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  725  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  726  			/* This entry's OA starts at the cut point, all done */
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  727  			if (!log2_mod(range->va, pt_entry_oa_lg2sz(&pts)))
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  728  				return 0;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  729  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  730  			/* This is a contiguous entry, split it down */
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  731  			if (pt_entry_num_contig_lg2(&pts) != ilog2(1)) {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  732  				if (!pts_feature(&pts, PT_FEAT_OA_SIZE_CHANGE))
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  733  					return -EOPNOTSUPP;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  734  				replace_contiguous_entry(&pts);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03 @735  				continue;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  736  			}
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  737  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  738  			/*
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  739  			 * Need to replace an OA with a table. The new table
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  740  			 * will map the same OA as the table item, just with
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  741  			 * smaller granularity.
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  742  			 */
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  743  			ret = replace_cut_table(&pts, cut_attrs);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  744  			if (ret == -EAGAIN)
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  745  				continue;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  746  			return ret;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  747  		}
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  748  		}
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  749  	} while (false);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  750  	return -ENOENT;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  751  }
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  752  

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Jason Gunthorpe <jgg@nvidia.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev
Subject: [jgunthorpe:iommu_pt_all 41/56] drivers/iommu/generic_pt/fmt/../iommu_pt.h:735 __cut_mapping() warn: continue to end of do { ... } while(0); loop
Date: Mon, 1 Sep 2025 13:59:13 +0300	[thread overview]
Message-ID: <202508301321.c3GXwQnF-lkp@intel.com> (raw)
Message-ID: <20250901105913.YwPSH5nAkaUafQYkxVTwZh_GpI1yTR95-EXTFdE0niA@z> (raw)

tree:   https://github.com/jgunthorpe/linux iommu_pt_all
head:   451e6e58d3fc7e3c1eb9a6d5bfb5d5da4b088133
commit: e3440a4e2ef96292c91a870405399bfcc197e973 [41/56] iommupt: Add cut_mapping op
config: powerpc-randconfig-r072-20250830 (https://download.01.org/0day-ci/archive/20250830/202508301321.c3GXwQnF-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project ac23f7465eedd0dd565ffb201f573e7a69695fa3)

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202508301321.c3GXwQnF-lkp@intel.com/

New smatch warnings:
drivers/iommu/generic_pt/fmt/../iommu_pt.h:735 __cut_mapping() warn: continue to end of do { ... } while(0); loop

vim +735 drivers/iommu/generic_pt/fmt/../iommu_pt.h

e3440a4e2ef962 Jason Gunthorpe 2025-04-03  711  static int __cut_mapping(struct pt_range *range, void *arg, unsigned int level,
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  712  			 struct pt_table_p *table)
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  713  {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  714  	struct pt_state pts = pt_init(range, level, table);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  715  	const struct pt_write_attrs *cut_attrs = arg;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  716  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  717  	do {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  718  		switch (pt_load_single_entry(&pts)) {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  719  		case PT_ENTRY_EMPTY:
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  720  			return -ENOENT;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  721  		case PT_ENTRY_TABLE:
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  722  			return pt_descend(&pts, arg, __cut_mapping);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  723  		case PT_ENTRY_OA: {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  724  			int ret;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  725  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  726  			/* This entry's OA starts at the cut point, all done */
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  727  			if (!log2_mod(range->va, pt_entry_oa_lg2sz(&pts)))
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  728  				return 0;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  729  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  730  			/* This is a contiguous entry, split it down */
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  731  			if (pt_entry_num_contig_lg2(&pts) != ilog2(1)) {
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  732  				if (!pts_feature(&pts, PT_FEAT_OA_SIZE_CHANGE))
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  733  					return -EOPNOTSUPP;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  734  				replace_contiguous_entry(&pts);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03 @735  				continue;

This continue would be more readable as a return -ENOENT;

e3440a4e2ef962 Jason Gunthorpe 2025-04-03  736  			}
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  737  
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  738  			/*
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  739  			 * Need to replace an OA with a table. The new table
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  740  			 * will map the same OA as the table item, just with
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  741  			 * smaller granularity.
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  742  			 */
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  743  			ret = replace_cut_table(&pts, cut_attrs);
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  744  			if (ret == -EAGAIN)
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  745  				continue;

Yeah.  continue wasn't intended...  

e3440a4e2ef962 Jason Gunthorpe 2025-04-03  746  			return ret;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  747  		}
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  748  		}
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  749  	} while (false);
                                                          ^^^^^^^^^^^^^^

e3440a4e2ef962 Jason Gunthorpe 2025-04-03  750  	return -ENOENT;
e3440a4e2ef962 Jason Gunthorpe 2025-04-03  751  }

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


             reply	other threads:[~2025-08-30  5:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-30  5:35 kernel test robot [this message]
2025-09-01 10:59 ` [jgunthorpe:iommu_pt_all 41/56] drivers/iommu/generic_pt/fmt/../iommu_pt.h:735 __cut_mapping() warn: continue to end of do { ... } while(0); loop Dan Carpenter
2025-09-02 16:46 ` Jason Gunthorpe

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=202508301321.c3GXwQnF-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@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 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.