All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Howells <dhowells@redhat.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [dhowells-fs:netfs-next 33/50] fs/netfs/bvecq.c:153:15: warning: implicit truncation from 'int' to bit-field changes value from 3 to -1
Date: Fri, 15 May 2026 04:31:35 +0800	[thread overview]
Message-ID: <202605150457.18ZdCIcX-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-next
head:   da61c0cc3991fe9aab4894d85ab80021d1f24929
commit: c61bbe667e764ee7f7bc98b9003b225e91eabc69 [33/50] netfs: Add some tools for managing bvecq chains
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20260515/202605150457.18ZdCIcX-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/20260515/202605150457.18ZdCIcX-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/202605150457.18ZdCIcX-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/netfs/bvecq.c:153:15: warning: implicit truncation from 'int' to bit-field changes value from 3 to -1 [-Wbitfield-constant-conversion]
     153 |                 p->mem_type = BVECQ_MEM_ALLOCED;
         |                             ^ ~~~~~~~~~~~~~~~~~
   fs/netfs/bvecq.c:288:16: warning: implicit truncation from 'int' to bit-field changes value from 3 to -1 [-Wbitfield-constant-conversion]
     288 |                         p->mem_type = BVECQ_MEM_ALLOCED;
         |                                     ^ ~~~~~~~~~~~~~~~~~
   2 warnings generated.


vim +/int +153 fs/netfs/bvecq.c

   116	
   117	/**
   118	 * bvecq_alloc_buffer - Allocate a bvecq chain and populate with buffers
   119	 * @size: Target size of the buffer (can be 0 for an empty buffer)
   120	 * @pre_slots: Number of preamble slots to set aside
   121	 * @gfp: The allocation constraints.
   122	 *
   123	 * Allocate a chain of bvecq nodes and populate the slots with sufficient pages
   124	 * to provide at least the requested amount of space, leaving the first
   125	 * @pre_slots slots unset.  The pre-slots must all fit into the the first
   126	 * bvecq.
   127	 *
   128	 * The pages allocated may be compound pages larger than PAGE_SIZE and thus
   129	 * occupy fewer slots.  The pages have their refcounts set to 1 and can be
   130	 * passed to MSG_SPLICE_PAGES.
   131	 *
   132	 * Return: The first node pointer or NULL on allocation failure.
   133	 */
   134	struct bvecq *bvecq_alloc_buffer(size_t size, unsigned int pre_slots, gfp_t gfp)
   135	{
   136		struct bvecq *head = NULL, *tail = NULL, *p = NULL;
   137		size_t nr_per_bq = 32 - 3;
   138		size_t count = DIV_ROUND_UP(size, PAGE_SIZE);
   139	
   140		_enter("%zx,%zx,%u", size, count, pre_slots);
   141	
   142		if (WARN_ON_ONCE(pre_slots > nr_per_bq))
   143			return NULL;
   144	
   145		do {
   146			struct page **pages;
   147			int want, got;
   148	
   149			p = bvecq_alloc_one(umin(pre_slots + count, nr_per_bq), gfp);
   150			if (!p)
   151				goto oom;
   152	
 > 153			p->mem_type = BVECQ_MEM_ALLOCED;
   154	
   155			if (tail) {
   156				tail->next = p;
   157				p->prev = tail;
   158			} else {
   159				head = p;
   160			}
   161			tail = p;
   162			if (!count)
   163				break;
   164	
   165			/* Need to clear pre slots and pages[], so just clear all. */
   166			memset(p->bv, 0, p->max_slots * sizeof(p->bv[0]));
   167	
   168			pages = (struct page **)&p->bv[p->max_slots];
   169			pages -= p->max_slots - pre_slots;
   170	
   171			want = umin(count, p->max_slots - pre_slots);
   172			got = alloc_pages_bulk(gfp, want, pages);
   173			if (got < want) {
   174				for (int i = 0; i < got; i++) {
   175					__free_page(pages[i]);
   176					pages[i] = NULL;
   177				}
   178				goto oom;
   179			}
   180	
   181			tail->nr_slots = pre_slots + got;
   182			for (int i = 0; i < got; i++) {
   183				int j = pre_slots + i;
   184	
   185				set_page_count(pages[i], 1);
   186				bvec_set_page(&tail->bv[j], pages[i], PAGE_SIZE, 0);
   187			}
   188	
   189			count -= got;
   190			pre_slots = 0;
   191		} while (count > 0);
   192	
   193		return head;
   194	oom:
   195		bvecq_put(head);
   196		return NULL;
   197	}
   198	EXPORT_SYMBOL(bvecq_alloc_buffer);
   199	

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

                 reply	other threads:[~2026-05-14 21:23 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=202605150457.18ZdCIcX-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dhowells@redhat.com \
    --cc=llvm@lists.linux.dev \
    --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 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.