Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* drivers/net/ethernet/intel/ice/ice_acl_ctrl.c:234:6: warning: variable 'resp_buf' is used uninitialized whenever 'if' condition is true
@ 2026-07-02 20:41 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-02 20:41 UTC (permalink / raw)
  To: Real Valiquette
  Cc: llvm, oe-kbuild-all, 0day robot, Chinh Cao, Tony Nguyen,
	Marcin Szycik, Aleksandr Loktionov

tree:   https://github.com/intel-lab-lkp/linux/commits/Marcin-Szycik/ice-rename-shared-Flow-Director-functions-and-structs/20260702-193231
head:   4242d9c4546a94409fd9096939b3d1b14bcb6512
commit: c5d6fe3b94f051789022db8eff7e7b719a3bef10 ice: initialize ACL table
date:   9 hours ago
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260702/202607022231.FWjSU75X-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260702/202607022231.FWjSU75X-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/202607022231.FWjSU75X-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/intel/ice/ice_acl_ctrl.c:234:6: warning: variable 'resp_buf' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     234 |         if (!tbl) {
         |             ^~~~
   drivers/net/ethernet/intel/ice/ice_acl_ctrl.c:287:39: note: uninitialized use occurs here
     287 |         ice_aq_dealloc_acl_tbl(hw, alloc_id, resp_buf, NULL);
         |                                              ^~~~~~~~
   drivers/net/ethernet/intel/ice/ice_acl_ctrl.c:234:2: note: remove the 'if' if its condition is always false
     234 |         if (!tbl) {
         |         ^~~~~~~~~~~
     235 |                 err = -ENOMEM;
         |                 ~~~~~~~~~~~~~~
     236 |                 goto err_dealloc_tbl;
         |                 ~~~~~~~~~~~~~~~~~~~~~
     237 |         }
         |         ~
   drivers/net/ethernet/intel/ice/ice_acl_ctrl.c:175:38: note: initialize the variable 'resp_buf' to silence this warning
     175 |         struct ice_aqc_acl_generic *resp_buf;
         |                                             ^
         |                                              = NULL
   1 warning generated.


vim +234 drivers/net/ethernet/intel/ice/ice_acl_ctrl.c

   160	
   161	/**
   162	 * ice_acl_create_tbl - create ACL table
   163	 * @hw: pointer to the HW struct
   164	 * @params: parameters for the table to be created
   165	 *
   166	 * Create a LEM table for ACL usage. We are currently starting with some fixed
   167	 * values for the size of the table, but this will need to grow as more flow
   168	 * entries are added by the user level.
   169	 *
   170	 * Return: 0 on success, negative on error
   171	 */
   172	int ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)
   173	{
   174		struct ice_acl_alloc_tbl tbl_alloc = {};
   175		struct ice_aqc_acl_generic *resp_buf;
   176		u16 width, depth, first_e, last_e;
   177		struct ice_acl_tbl *tbl;
   178		u16 alloc_id;
   179		int err;
   180	
   181		if (hw->acl_tbl)
   182			return -EEXIST;
   183	
   184		/* round up the width to the next TCAM width boundary. */
   185		width = roundup(params->width, (u16)ICE_AQC_ACL_KEY_WIDTH_BYTES);
   186		/* depth should be provided in chunk (64 entry) increments */
   187		depth = ALIGN(params->depth, ICE_ACL_ENTRY_ALLOC_UNIT);
   188	
   189		if (params->entry_act_pairs < width / ICE_AQC_ACL_KEY_WIDTH_BYTES) {
   190			params->entry_act_pairs = width / ICE_AQC_ACL_KEY_WIDTH_BYTES;
   191	
   192			if (params->entry_act_pairs > ICE_AQC_TBL_MAX_ACTION_PAIRS)
   193				params->entry_act_pairs = ICE_AQC_TBL_MAX_ACTION_PAIRS;
   194		}
   195	
   196		/* Validate that width*depth will not exceed the TCAM limit */
   197		if ((DIV_ROUND_UP(depth, ICE_AQC_ACL_TCAM_DEPTH) *
   198		     (width / ICE_AQC_ACL_KEY_WIDTH_BYTES)) > ICE_AQC_ACL_SLICES)
   199			return -ENOSPC;
   200	
   201		tbl_alloc.width = width;
   202		tbl_alloc.depth = depth;
   203		tbl_alloc.act_pairs_per_entry = params->entry_act_pairs;
   204		tbl_alloc.concurr = params->concurr;
   205	
   206		if (params->concurr) {
   207			int i;
   208	
   209			tbl_alloc.num_dependent_alloc_ids = params->num_dep_tbls;
   210	
   211			for (i = 0; i < params->num_dep_tbls; i++)
   212				tbl_alloc.buf.data_buf.alloc_ids[i] =
   213					cpu_to_le16(params->dep_tbls[i]);
   214	
   215			for (; i < ICE_AQC_MAX_CONCURRENT_ACL_TBL; i++)
   216				tbl_alloc.buf.data_buf.alloc_ids[i] =
   217					cpu_to_le16(ICE_AQC_CONCURR_ID_INVALID);
   218		}
   219	
   220		err = ice_aq_alloc_acl_tbl(hw, &tbl_alloc, NULL);
   221		if (err) {
   222			dev_err(ice_hw_to_dev(hw), "ACL table allocation failed with error %d\n",
   223				err);
   224			return err;
   225		}
   226	
   227		alloc_id = le16_to_cpu(tbl_alloc.buf.resp_buf.alloc_id);
   228		if (alloc_id < ICE_AQC_ALLOC_ID_4K) {
   229			dev_err(ice_hw_to_dev(hw), "ACL table allocation failed due to unavailable resources.\n");
   230			return -ENOMEM;
   231		}
   232	
   233		tbl = kzalloc_obj(*tbl);
 > 234		if (!tbl) {
   235			err = -ENOMEM;
   236			goto err_dealloc_tbl;
   237		}
   238	
   239		resp_buf = &tbl_alloc.buf.resp_buf;
   240	
   241		/* Retrieve information of the allocated table */
   242		tbl->id = alloc_id;
   243		tbl->first_tcam = resp_buf->ops.table.first_tcam;
   244		tbl->last_tcam = resp_buf->ops.table.last_tcam;
   245		tbl->first_entry = le16_to_cpu(resp_buf->first_entry);
   246		tbl->last_entry = le16_to_cpu(resp_buf->last_entry);
   247	
   248		tbl->info = *params;
   249		tbl->info.width = width;
   250		tbl->info.depth = depth;
   251		hw->acl_tbl = tbl;
   252	
   253		for (int i = 0; i < ICE_AQC_MAX_ACTION_MEMORIES; i++)
   254			tbl->act_mems[i].act_mem = resp_buf->act_mem[i];
   255	
   256		/* Figure out which TCAMs that these newly allocated action memories
   257		 * belong to.
   258		 */
   259		ice_acl_divide_act_mems_to_tcams(tbl);
   260	
   261		/* Initialize the resources allocated by invalidating all TCAM entries
   262		 * and all the action pairs
   263		 */
   264		err = ice_acl_init_tbl(hw);
   265		if (err) {
   266			ice_debug(hw, ICE_DBG_ACL, "Initialization of TCAM entries failed. status: %d\n",
   267				  err);
   268			goto err_free_tbl;
   269		}
   270	
   271		first_e = (tbl->first_tcam * ICE_AQC_MAX_TCAM_ALLOC_UNITS) +
   272			(tbl->first_entry / ICE_ACL_ENTRY_ALLOC_UNIT);
   273		last_e = (tbl->last_tcam * ICE_AQC_MAX_TCAM_ALLOC_UNITS) +
   274			(tbl->last_entry / ICE_ACL_ENTRY_ALLOC_UNIT);
   275	
   276		/* Indicate available entries in the table */
   277		bitmap_set(tbl->avail, first_e, last_e - first_e + 1);
   278	
   279		INIT_LIST_HEAD(&tbl->scens);
   280	
   281		return 0;
   282	
   283	err_free_tbl:
   284		hw->acl_tbl = NULL;
   285		kfree(tbl);
   286	err_dealloc_tbl:
   287		ice_aq_dealloc_acl_tbl(hw, alloc_id, resp_buf, NULL);
   288		return err;
   289	}
   290	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-02 20:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 20:41 drivers/net/ethernet/intel/ice/ice_acl_ctrl.c:234:6: warning: variable 'resp_buf' is used uninitialized whenever 'if' condition is true kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox