All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Rosen Penev <rosenp@gmail.com>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: be2iscsi: kzalloc + kcalloc to kzalloc_flex
Date: Sat, 21 Mar 2026 12:50:36 +0100	[thread overview]
Message-ID: <202603211230.849vqwiI-lkp@intel.com> (raw)
In-Reply-To: <20260320010957.32355-1-rosenp@gmail.com>

Hi Rosen,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next next-20260320]
[cannot apply to linus/master v6.16-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/scsi-be2iscsi-kzalloc-kcalloc-to-kzalloc_flex/20260321-145321
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20260320010957.32355-1-rosenp%40gmail.com
patch subject: [PATCH] scsi: be2iscsi: kzalloc + kcalloc to kzalloc_flex
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260321/202603211230.849vqwiI-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260321/202603211230.849vqwiI-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/202603211230.849vqwiI-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/scsi/be2iscsi/be_main.c:2468:25: warning: variable 'phwi_ctrlr' set but not used [-Wunused-but-set-variable]
    2468 |         struct hwi_controller *phwi_ctrlr;
         |                                ^
   1 warning generated.


vim +/phwi_ctrlr +2468 drivers/scsi/be2iscsi/be_main.c

6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2464  
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2465  static int beiscsi_alloc_mem(struct beiscsi_hba *phba)
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2466  {
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2467  	dma_addr_t bus_add;
a7909b396ba79a Jayamohan Kallickal 2013-04-05 @2468  	struct hwi_controller *phwi_ctrlr;
a7909b396ba79a Jayamohan Kallickal 2013-04-05  2469  	struct be_mem_descriptor *mem_descr;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2470  	struct mem_array *mem_arr, *mem_arr_orig;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2471  	unsigned int i, j, alloc_size, curr_alloc_size;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2472  
7051e9804743be Rosen Penev         2026-03-19  2473  	phba->phwi_ctrlr = kzalloc_flex(*phba->phwi_ctrlr, wrb_context, phba->params.cxns_per_ctrl);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2474  	if (!phba->phwi_ctrlr)
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2475  		return -ENOMEM;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2476  
a7909b396ba79a Jayamohan Kallickal 2013-04-05  2477  	/* Allocate memory for wrb_context */
a7909b396ba79a Jayamohan Kallickal 2013-04-05  2478  	phwi_ctrlr = phba->phwi_ctrlr;
a7909b396ba79a Jayamohan Kallickal 2013-04-05  2479  
bf4afc53b77aea Linus Torvalds      2026-02-21  2480  	phba->init_mem = kzalloc_objs(*mem_descr, SE_MEM_MAX);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2481  	if (!phba->init_mem) {
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2482  		kfree(phba->phwi_ctrlr);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2483  		return -ENOMEM;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2484  	}
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2485  
32a92f8c893269 Linus Torvalds      2026-02-21  2486  	mem_arr_orig = kmalloc_objs(*mem_arr_orig, BEISCSI_MAX_FRAGS_INIT);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2487  	if (!mem_arr_orig) {
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2488  		kfree(phba->init_mem);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2489  		kfree(phba->phwi_ctrlr);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2490  		return -ENOMEM;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2491  	}
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2492  
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2493  	mem_descr = phba->init_mem;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2494  	for (i = 0; i < SE_MEM_MAX; i++) {
8a86e8336f37fd Jayamohan Kallickal 2013-09-28  2495  		if (!phba->mem_req[i]) {
8a86e8336f37fd Jayamohan Kallickal 2013-09-28  2496  			mem_descr->mem_array = NULL;
8a86e8336f37fd Jayamohan Kallickal 2013-09-28  2497  			mem_descr++;
8a86e8336f37fd Jayamohan Kallickal 2013-09-28  2498  			continue;
8a86e8336f37fd Jayamohan Kallickal 2013-09-28  2499  		}
8a86e8336f37fd Jayamohan Kallickal 2013-09-28  2500  
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2501  		j = 0;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2502  		mem_arr = mem_arr_orig;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2503  		alloc_size = phba->mem_req[i];
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2504  		memset(mem_arr, 0, sizeof(struct mem_array) *
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2505  		       BEISCSI_MAX_FRAGS_INIT);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2506  		curr_alloc_size = min(be_max_phys_size * 1024, alloc_size);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2507  		do {
26a4c991af99f1 Christoph Hellwig   2018-10-10  2508  			mem_arr->virtual_address =
26a4c991af99f1 Christoph Hellwig   2018-10-10  2509  				dma_alloc_coherent(&phba->pcidev->dev,
26a4c991af99f1 Christoph Hellwig   2018-10-10  2510  					curr_alloc_size, &bus_add, GFP_KERNEL);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2511  			if (!mem_arr->virtual_address) {
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2512  				if (curr_alloc_size <= BE_MIN_MEM_SIZE)
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2513  					goto free_mem;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2514  				if (curr_alloc_size -
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2515  					rounddown_pow_of_two(curr_alloc_size))
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2516  					curr_alloc_size = rounddown_pow_of_two
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2517  							     (curr_alloc_size);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2518  				else
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2519  					curr_alloc_size = curr_alloc_size / 2;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2520  			} else {
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2521  				mem_arr->bus_address.u.
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2522  				    a64.address = (__u64) bus_add;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2523  				mem_arr->size = curr_alloc_size;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2524  				alloc_size -= curr_alloc_size;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2525  				curr_alloc_size = min(be_max_phys_size *
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2526  						      1024, alloc_size);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2527  				j++;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2528  				mem_arr++;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2529  			}
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2530  		} while (alloc_size);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2531  		mem_descr->num_elements = j;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2532  		mem_descr->size_in_bytes = phba->mem_req[i];
bf4afc53b77aea Linus Torvalds      2026-02-21  2533  		mem_descr->mem_array = kmalloc_objs(*mem_arr, j);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2534  		if (!mem_descr->mem_array)
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2535  			goto free_mem;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2536  
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2537  		memcpy(mem_descr->mem_array, mem_arr_orig,
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2538  		       sizeof(struct mem_array) * j);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2539  		mem_descr++;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2540  	}
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2541  	kfree(mem_arr_orig);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2542  	return 0;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2543  free_mem:
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2544  	mem_descr->num_elements = j;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2545  	while ((i) || (j)) {
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2546  		for (j = mem_descr->num_elements; j > 0; j--) {
26a4c991af99f1 Christoph Hellwig   2018-10-10  2547  			dma_free_coherent(&phba->pcidev->dev,
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2548  					    mem_descr->mem_array[j - 1].size,
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2549  					    mem_descr->mem_array[j - 1].
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2550  					    virtual_address,
457ff3b7dc3796 Jayamohan Kallickal 2010-07-22  2551  					    (unsigned long)mem_descr->
457ff3b7dc3796 Jayamohan Kallickal 2010-07-22  2552  					    mem_array[j - 1].
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2553  					    bus_address.u.a64.address);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2554  		}
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2555  		if (i) {
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2556  			i--;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2557  			kfree(mem_descr->mem_array);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2558  			mem_descr--;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2559  		}
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2560  	}
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2561  	kfree(mem_arr_orig);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2562  	kfree(phba->init_mem);
a7909b396ba79a Jayamohan Kallickal 2013-04-05  2563  	kfree(phba->phwi_ctrlr->wrb_context);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2564  	kfree(phba->phwi_ctrlr);
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2565  	return -ENOMEM;
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2566  }
6733b39a1301b0 Jayamohan Kallickal 2009-09-05  2567  

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

  parent reply	other threads:[~2026-03-21 11:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20  1:09 [PATCH] scsi: be2iscsi: kzalloc + kcalloc to kzalloc_flex Rosen Penev
2026-03-20 18:44 ` Kees Cook
2026-03-21 11:50 ` kernel test robot [this message]
2026-03-21 16:27 ` kernel test robot

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=202603211230.849vqwiI-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rosenp@gmail.com \
    /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.